diff --git a/.travis.yml b/.travis.yml index e7eccb2c0ff..973a0dc3ce8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,7 +62,7 @@ before_install: - gem install bundler - npm install -g typescript - npm install -g npm - - npm install -g elm@0.18.0-exp5 + #- npm install -g elm@0.18.0-exp5 - npm config set registry http://registry.npmjs.org/ # set python 3.6.3 as default - source ~/virtualenv/python3.6/bin/activate diff --git a/bitrise.yml b/CI/bitrise.yml similarity index 100% rename from bitrise.yml rename to CI/bitrise.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index baea26419bb..35663693484 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,7 +61,7 @@ Code change should conform to the programming style guide of the respective lang - Go: https://github.com/golang/go/wiki/CodeReviewComments - ObjC: https://github.com/NYTimes/objective-c-style-guide - Perl: http://perldoc.perl.org/perlstyle.html -- PHP: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md +- PHP: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md - PowerShell: https://msdn.microsoft.com/en-us/library/dd878270(v=vs.85).aspx - Python: https://www.python.org/dev/peps/pep-0008/ - R: https://google.github.io/styleguide/Rguide.xml diff --git a/Dockerfile b/Dockerfile index 6264997fd61..4aff7bed6fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,7 @@ RUN mvn -am -pl "modules/openapi-generator-cli" package # This exists at the end of the file to benefit from cached layers when modifying docker-entrypoint.sh. COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/README.md b/README.md index ddf1e8abaf0..6c42b513be1 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,26 @@
-[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.2.2-SNAPSHOT`): [![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.2.3-SNAPSHOT`): [![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) [![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/master)](https://cloud.drone.io/OpenAPITools/openapi-generator) +[![iOS Build Status](https://app.bitrise.io/app/4a2b10a819d12b67/status.svg?token=859FMDR8QHwabCzwvZK6vQ&branch=master)](https://app.bitrise.io/app/4a2b10a819d12b67) [`4.3.x`](https://github.com/OpenAPITools/openapi-generator/tree/4.3.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/4.3.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) [![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/4.3.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) [![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=4.3.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator) [![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=4.3.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) [![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/4.3.x)](https://cloud.drone.io/OpenAPITools/openapi-generator) +[![iOS Build Status](https://app.bitrise.io/app/4a2b10a819d12b67/status.svg?token=859FMDR8QHwabCzwvZK6vQ&branch=4.3.x)](https://app.bitrise.io/app/4a2b10a819d12b67) [`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) [![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=5.0.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator) [![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=5.0.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) [![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/5.0.x)](https://cloud.drone.io/OpenAPITools/openapi-generator) +[![iOS Build Status](https://app.bitrise.io/app/4a2b10a819d12b67/status.svg?token=859FMDR8QHwabCzwvZK6vQ&branch=5.0.x)](https://app.bitrise.io/app/4a2b10a819d12b67)
@@ -53,6 +56,8 @@ If you find OpenAPI Generator useful for work, please consider asking your compa [![NamSor](https://openapi-generator.tech/img/companies/namsor.png)](https://www.namsor.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) [![LightBow](https://openapi-generator.tech/img/companies/lightbow.png)](https://www.lightbow.net/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://docspring.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) + #### Thank you GoDaddy for sponsoring the domain names and Linode for sponsoring the VPS @@ -65,7 +70,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se | | Languages/Frameworks | |-|-| -**API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0), **C++** (cpp-restsdk, Qt5, Tizen), **Clojure**, **Dart (1.x, 2.x)**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client), **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (rust, rust-server), **Scala** (akka, http4s, scalaz, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x), **Typescript** (AngularJS, Angular (2.x - 8.x), Aurelia, Axios, Fetch, Inversify, jQuery, Node, Rxjs) +**API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0), **C++** (cpp-restsdk, Qt5, Tizen), **Clojure**, **Dart (1.x, 2.x)**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (rust, rust-server), **Scala** (akka, http4s, scalaz, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x), **Typescript** (AngularJS, Angular (2.x - 8.x), Aurelia, Axios, Fetch, Inversify, jQuery, Node, Rxjs) **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** ([Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc** **Configuration files** | [**Apache2**](https://httpd.apache.org/) @@ -109,8 +114,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.3.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.3.0-SNAPSHOT/)| 29.02.2020 | Minor release (breaking changes with fallbacks) -4.2.2-SNAPSHOT (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.2.2-SNAPSHOT/)| 02.12.2019 | Patch release -[4.2.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.2.1) (latest stable release) | 15.11.2019 | Patch release +4.2.3-SNAPSHOT (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.2.3-SNAPSHOT/)| 31.01.2020 | Patch release +[4.2.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.2.2) (latest stable release) | 02.12.2019 | Patch release OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0 @@ -166,16 +171,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository. 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.2.1/openapi-generator-cli-4.2.1.jar` +JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.2/openapi-generator-cli-4.2.2.jar` For **Mac/Linux** users: ```sh -wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.1/openapi-generator-cli-4.2.1.jar -O openapi-generator-cli.jar +wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.2/openapi-generator-cli-4.2.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.2.1/openapi-generator-cli-4.2.1.jar +Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.2/openapi-generator-cli-4.2.2.jar ``` After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage. @@ -417,7 +422,7 @@ 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.2.1/openapi-generator-cli-4.2.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.2.2/openapi-generator-cli-4.2.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` @@ -577,13 +582,15 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [Camptocamp](https://www.camptocamp.com/en) - [codecentric AG](https://www.codecentric.de/) - [Commencis](https://www.commencis.com/) +- [Crossover Health](https://crossoverhealth.com/) - [Cupix](https://www.cupix.com/) - [DB Systel](https://www.dbsystel.de) +- [DocSpring](https://docspring.com/) - [dwango](https://dwango.co.jp/) - [Edge Impulse](https://www.edgeimpulse.com/) - [Element AI](https://www.elementai.com/) +- [Embotics](https://www.embotics.com/) - [Fenergo](https://www.fenergo.com/) -- [FormAPI](https://formapi.io/) - [FreshCells](https://www.freshcells.de/) - [Fuse](https://www.fuse.no/) - [Gantner](https://www.gantner.com) @@ -596,6 +603,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [JustStar](https://www.juststarinfo.com) - [Klarna](https://www.klarna.com/) - [Kronsoft Development](https://www.kronsoft.ro/home/) +- [Linode](https://www.linode.com/) - [Médiavision](https://www.mediavision.fr/) - [Metaswitch](https://www.metaswitch.com/) - [Myworkout](https://myworkout.com) @@ -611,6 +619,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [RedHat](https://www.redhat.com) - [RepreZen API Studio](https://www.reprezen.com/swagger-openapi-code-generation-api-first-microservices-enterprise-development) - [REST United](https://restunited.com) +- [Sony Interactive Entertainment](https://www.sie.com/en/index.html) - [Stingray](http://www.stingray.com) - [Suva](https://www.suva.ch/) - [Telstra](https://dev.telstra.com) @@ -621,6 +630,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [WSO2](https://wso2.com/) - [Vouchery.io](https://vouchery.io) - [Xero](https://www.xero.com/) +- [Yahoo Japan](https://www.yahoo.co.jp/) - [Yelp](https://www.yelp.com/) - [Zalando](https://www.zalando.com) @@ -694,7 +704,15 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2019-11-07 - [API First development with OpenAPI - You should you practise it !?](https://www.youtube.com/watch?v=F9iF3a1Z8Y8) by [Nick Van Hoof](https://www.nickvanhoof.com/) at [Devoxx Belgium 2019](https://devoxx.be/) - 2019-11-08 - [JHipster beyond CRUD - API-First for Enterprises by Enrico Costanzi](https://www.youtube.com/watch?v=m28JFovKQ20) by [Enrico Costanzi](https://twitter.com/enricocostanzi) at [JHipster Conf 2019 in Paris](https://jhipster-conf.github.io/) - 2019-11-11 - [TypeScript REST APIクライアント](https://qiita.com/unhurried/items/7b74f7d3c43545dadd2b) by [@unhurried](https://qiita.com/unhurried) -- 2019-11-11 - [One Spec to Rule them all - OpenAPI in Action](https://www.youtube.com/watch?v=MMay_nht8ec) by [Andreas Litt](https://github.com/littldr) at [code.talks 2019](https://www.codetalks.com/) +- 2019-11-11 - [One Spec to Rule them all - OpenAPI in Action](https://www.youtube.com/watch?v=MMay_nht8ec) by [Andreas Litt](https://github.com/littldr) at [code.talks 2019](https://www.codetalks.com/) +- 2019-11-17 - [OpenAPI Generator YouTube playlist](https://www.youtube.com/playlist?list=PLtJyHVMdzfF6fBkOUV5VDVErP23CGgHIy) at [YouTube](https://www.youtube.com) +- 2019-11-20 - [Introduction to OpenAPI](https://noti.st/lornajane/HvDH7U/introduction-to-openapi) by [Lorna Mitchell](https://twitter.com/lornajane) at [GOTO Copenhagen 2019](https://gotocph.com/2019/) +- 2019-11-20 - [How to Generate Angular code from OpenAPI specifications](https://dotnetthoughts.net/how-to-generate-angular-code-from-openapi-specifications/) by Anuraj +- 2019-11-23 - [Swagger ではない OpenAPI Specification 3.0 による API サーバー開発](https://www.slideshare.net/techblogyahoo/swagger-openapi-specification-30-api) by [Tetsuya Morimoto](https://github.com/t2y) at [JJUG CCC 2019 Fall](https://ccc2019fall.java-users.jp/) +- 2019-11-24 - [Accelerate Flutter development with OpenAPI and Dart code generation](https://medium.com/@irinasouthwell_220/accelerate-flutter-development-with-openapi-and-dart-code-generation-1f16f8329a6a) by [Irina Southwell](https://medium.com/@irinasouthwell_220) +- 2019-11-25 - [openapi-generatorで手軽にスタブサーバとクライアントの生成](https://qiita.com/pochopocho13/items/8db662e1934fb2b408b8) by [@pochopocho13](https://twitter.com/pochopocho13) +- 2019-11-26 - [CordaCon 2019 Highlights: Braid Server and OpenAPI Generator for Corda Client API’s](https://blog.b9lab.com/cordacon-2019-highlights-braid-server-and-openapi-generator-for-corda-flows-api-s-d24179ccb27c) by [Adel Rustum](https://blog.b9lab.com/@adelrestom) at [B9lab](https://blog.b9lab.com/) +- 2020-12-04 - [Angular+NestJS+OpenAPI(Swagger)でマイクロサービスを視野に入れた環境を考える](https://qiita.com/teracy55/items/0327c7a170ec772970c6) by [てらしー](https://twitter.com/teracy55) ## [6 - About Us](#table-of-contents) @@ -784,6 +802,7 @@ Here is a list of template creators: * TypeScript (Node): @mhardorf * TypeScript (Rxjs): @denyo * TypeScript (Inversify): @gualtierim + * TypeSCript (redux-query): @petejohansonxo * Server Stubs * Ada: @stcarrez * C# ASP.NET 5: @jimschubert [:heart:](https://www.patreon.com/jimschubert) @@ -902,8 +921,8 @@ If you want to join the committee, please kindly apply by sending an email to te | Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) | | Rust | @frol (2017/07) @farcaller (2017/08) @bjgill (2017/12) @richardwhiuk (2019/07) | | Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03) | -| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @d-date (2018/03) | -| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) @topce (2018/10) @akehir (2019/07) | +| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) | +| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) | :heart: = Link to support the contributor directly diff --git a/bin/ci/php-slim4-server-petstore.json b/bin/ci/php-slim4-server-petstore.json new file mode 100644 index 00000000000..1bfab4a21bc --- /dev/null +++ b/bin/ci/php-slim4-server-petstore.json @@ -0,0 +1,6 @@ +{ + "generatorName": "php-slim4", + "inputSpec": "modules/openapi-generator/src/test/resources/3_0/petstore.yaml", + "outputDir": "samples/server/petstore/php-slim4", + "templateDir": "modules/openapi-generator/src/main/resources/php-slim4-server" +} \ No newline at end of file diff --git a/bin/java-petstore-all.sh b/bin/java-petstore-all.sh index a593b707c25..6eed10ebe38 100755 --- a/bin/java-petstore-all.sh +++ b/bin/java-petstore-all.sh @@ -7,6 +7,7 @@ ./bin/java-petstore-jersey1.sh ./bin/java-petstore-jersey2-java6.sh ./bin/java-petstore-jersey2.sh +./bin/java-petstore-microprofile.sh ./bin/java-petstore-native.sh ./bin/java-petstore-okhttp-gson-parcelable.sh ./bin/java-petstore-okhttp-gson.sh diff --git a/bin/java-petstore-feign.sh b/bin/java-petstore-feign.sh index abac67deb9d..48038613a82 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 --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=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,additionalModelTypeAnnotations=@javax.annotation.concurrent.Immutable $@" 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-microprofile.sh b/bin/java-petstore-microprofile.sh new file mode 100755 index 00000000000..b7a93f6a985 --- /dev/null +++ b/bin/java-petstore-microprofile.sh @@ -0,0 +1,36 @@ +#!/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 -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate --artifact-id "microprofile-rest-client" -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java --library microprofile -o samples/client/petstore/java/microprofile-rest-client $@" + +echo "Removing files and folders under samples/client/petstore/java/microprofile-rest-client/src/main" +rm -rf samples/client/petstore/java/microprofile-rest-client/src/main +find samples/client/petstore/java/microprofile-rest-client -maxdepth 1 -type f ! -name "README.md" -exec rm {} + + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/kotlin-springboot-petstore-all.sh b/bin/kotlin-springboot-petstore-all.sh index b0ba7a6e825..b24ada15722 100755 --- a/bin/kotlin-springboot-petstore-all.sh +++ b/bin/kotlin-springboot-petstore-all.sh @@ -1,4 +1,5 @@ #!/bin/sh ./bin/kotlin-springboot-petstore-server.sh -./bin/kotlin-springboot-petstore-server-reactive.sh \ No newline at end of file +./bin/kotlin-springboot-petstore-server-reactive.sh +./bin/kotlin-springboot-petstore-server-model-mutable.sh diff --git a/bin/kotlin-springboot-petstore-server-model-mutable.sh b/bin/kotlin-springboot-petstore-server-model-mutable.sh new file mode 100755 index 00000000000..ed3712db26a --- /dev/null +++ b/bin/kotlin-springboot-petstore-server-model-mutable.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-modelMutable --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,serializableModel=true,modelMutable=true" + +echo "Cleaning previously generated files if any from samples/server/petstore/kotlin-springboot" +rm -rf samples/server/petstore/kotlin-springboot-modelMutable + +echo "Generating Kotling Spring Boot server..." +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/kotlin-vertx-server-petstore.sh b/bin/kotlin-vertx-server-petstore.sh index 73d0d087f3b..7cfc82179c5 100755 --- a/bin/kotlin-vertx-server-petstore.sh +++ b/bin/kotlin-vertx-server-petstore.sh @@ -26,6 +26,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 kotlin-vertx -o samples/server/petstore/kotlin/vertx" +ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin-vertx -o samples/server/petstore/kotlin/vertx --additional-properties=modelMutable=false" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/openapi3/kotlin-client-petstore-nullable-required.sh b/bin/openapi3/kotlin-client-petstore-nullable-required.sh new file mode 100644 index 00000000000..18c09a54cac --- /dev/null +++ b/bin/openapi3/kotlin-client-petstore-nullable-required.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-with-nullable-required.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-nullable-required --additional-properties allowRequiredAsNullable=true -o samples/openapi3/client/petstore/kotlin-nullable-required $@" + +echo "Cleaning previously generated files if any from samples/openapi3/client/petstore/kotlin-nullable-required" +rm -rf samples/openapi3/client/petstore/kotlin-nullable-required + +echo "Generating Kotling client..." +java $JAVA_OPTS -jar $executable $ags \ No newline at end of file diff --git a/bin/openapi3/windows/kotlin-client-nullable-required.bat b/bin/openapi3/windows/kotlin-client-nullable-required.bat new file mode 100644 index 00000000000..dd7bf0d16a7 --- /dev/null +++ b/bin/openapi3/windows/kotlin-client-nullable-required.bat @@ -0,0 +1,10 @@ +set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M +set ags=generate -i modules\openapi-generator\src\test\resources\3_0\petstore-with-nullable-required.yaml -g kotlin --artifact-id "kotlin-petstore-nullable-required" --additional-properties allowRequiredAsNullable=true -o samples\openapi3\client\petstore\kotlin-nullable-required + +java %JAVA_OPTS% -jar %executable% %ags% \ No newline at end of file diff --git a/bin/swift4-petstore-all.sh b/bin/swift4-petstore-all.sh index b8d8cd47b26..167a7a68481 100755 --- a/bin/swift4-petstore-all.sh +++ b/bin/swift4-petstore-all.sh @@ -2,6 +2,8 @@ ./bin/swift4-petstore.sh ./bin/swift4-petstore-promisekit.sh +./bin/swift4-petstore-result.sh ./bin/swift4-petstore-rxswift.sh ./bin/swift4-petstore-objcCompatible.sh ./bin/swift4-petstore-unwrapRequired.sh +./bin/swift4-petstore-nonPublicApi.sh diff --git a/bin/swift4-petstore-nonPublicApi.json b/bin/swift4-petstore-nonPublicApi.json new file mode 100644 index 00000000000..c8cf09f065e --- /dev/null +++ b/bin/swift4-petstore-nonPublicApi.json @@ -0,0 +1,7 @@ +{ + "podSummary": "PetstoreClient", + "podHomepage": "https://github.com/openapitools/openapi-generator", + "podAuthors": "", + "projectName": "PetstoreClient", + "nonPublicApi": true +} diff --git a/bin/swift4-petstore-nonPublicApi.sh b/bin/swift4-petstore-nonPublicApi.sh new file mode 100755 index 00000000000..0018a2af49b --- /dev/null +++ b/bin/swift4-petstore-nonPublicApi.sh @@ -0,0 +1,42 @@ +#!/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 -B clean package +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/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-nonPublicApi.json -o samples/client/petstore/swift4/nonPublicApi --generate-alias-as-model $@" + +java $JAVA_OPTS -jar $executable $ags + +if type "xcodegen" > /dev/null 2>&1; then + cd samples/client/petstore/swift4/nonPublicApi + xcodegen generate +fi + +if type "swiftlint" > /dev/null 2>&1; then + cd samples/client/petstore/swift4/nonPublicApi + swiftlint autocorrect +fi \ No newline at end of file diff --git a/bin/swift4-petstore-result.json b/bin/swift4-petstore-result.json new file mode 100644 index 00000000000..31543386786 --- /dev/null +++ b/bin/swift4-petstore-result.json @@ -0,0 +1,7 @@ +{ + "podSummary": "PetstoreClient", + "podHomepage": "https://github.com/openapitools/openapi-generator", + "podAuthors": "", + "projectName": "PetstoreClient", + "responseAs": "Result" +} diff --git a/bin/swift4-petstore-result.sh b/bin/swift4-petstore-result.sh new file mode 100755 index 00000000000..a5ba0470034 --- /dev/null +++ b/bin/swift4-petstore-result.sh @@ -0,0 +1,42 @@ +#!/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 -B clean package +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/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-result.json -o samples/client/petstore/swift4/resultLibrary --generate-alias-as-model $@" + +java $JAVA_OPTS -jar $executable $ags + +if type "xcodegen" > /dev/null 2>&1; then + cd samples/client/petstore/swift4/resultLibrary + xcodegen generate +fi + +if type "swiftlint" > /dev/null 2>&1; then + cd samples/client/petstore/swift4/resultLibrary + swiftlint autocorrect +fi \ No newline at end of file diff --git a/bin/windows/java-petstore-feign.bat b/bin/windows/java-petstore-feign.bat index e68e2d818f7..261965dcb6f 100644 --- a/bin/windows/java-petstore-feign.bat +++ b/bin/windows/java-petstore-feign.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set 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 +set 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,additionalModelTypeAnnotations=@javax.annotation.concurrent.Immutable java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-microprofile.bat b/bin/windows/java-petstore-microprofile.bat new file mode 100755 index 00000000000..4367768ea1b --- /dev/null +++ b/bin/windows/java-petstore-microprofile.bat @@ -0,0 +1,10 @@ +set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties +set ags=generate --artifact-id "microprofile-rest-client" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g java --library microprofile -o samples\client\petstore\java\microprofile-rest-client + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat b/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat index 2b271e1a2a5..f96184e5d22 100644 --- a/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat +++ b/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat @@ -7,6 +7,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -c bin\typescript-fetch-petstore-prefix-parameter-interfaces.json -o samples\client\petstore\typescript-fetch\builds\prefix-parameter-interfaces java %JAVA_OPTS% -jar %executable% %ags% diff --git a/docs/contributing.md b/docs/contributing.md index dee52bd40db..aa0e6f4ff89 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -65,7 +65,7 @@ Code change should conform to the programming style guide of the respective lang - Go: https://github.com/golang/go/wiki/CodeReviewComments - ObjC: https://github.com/NYTimes/objective-c-style-guide - Perl: http://perldoc.perl.org/perlstyle.html -- PHP: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md +- PHP: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md - PowerShell: https://msdn.microsoft.com/en-us/library/dd878270(v=vs.85).aspx - Python: https://www.python.org/dev/peps/pep-0008/ - R: https://google.github.io/styleguide/Rguide.xml diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index 7dcf10b0777..688b2b1ac93 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -34,6 +34,7 @@ sidebar_label: groovy |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index 4d3c774468e..37856678e67 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -36,6 +36,7 @@ sidebar_label: java-inflector |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index 543aa97f828..ece46f99046 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -36,6 +36,7 @@ sidebar_label: java-msf4j |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index 6d33790e60c..30eff4add44 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -36,6 +36,7 @@ sidebar_label: java-pkmst |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index b7fa80b5823..bad8968d3e2 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -36,6 +36,7 @@ sidebar_label: java-play-framework |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index c620227b1ee..6b780fa3f41 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -36,6 +36,7 @@ sidebar_label: java-undertow-server |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index 059acc0a2a0..23aee105dd9 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -36,6 +36,7 @@ sidebar_label: java-vertx-web |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index e285f021a16..27240770c34 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -36,6 +36,7 @@ sidebar_label: java-vertx |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/java.md b/docs/generators/java.md index 2ac7fbeaab5..4cd473853b2 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -36,6 +36,7 @@ sidebar_label: java |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| @@ -53,5 +54,5 @@ sidebar_label: java |feignVersion|Version of OpenFeign: '10.x', '9.x' (default)| |false| |useReflectionEqualsHashCode|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.| |false| |caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false| -|library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.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.9.x
**feign**
HTTP client: OpenFeign 9.x or 10.x. JSON processing: Jackson 2.9.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.9.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.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.9.x. Only for Java8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
|okhttp-gson| +|library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.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.9.x
**feign**
HTTP client: OpenFeign 9.x or 10.x. JSON processing: Jackson 2.9.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.9.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.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.9.x. Only for Java8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
**microprofile**
HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x
|okhttp-gson| |serializationLibrary|Serialization library, default depends from the library|
**jackson**
Use Jackson as serialization library
**gson**
Use Gson as serialization library
|null| diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index e90da21468b..5a1cbe843b4 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -36,6 +36,7 @@ sidebar_label: jaxrs-cxf-cdi |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index 8b9ea2186ac..46f554eb3d8 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -36,6 +36,7 @@ sidebar_label: jaxrs-cxf-client |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index df0d2004bd0..9259685cc18 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -36,6 +36,7 @@ sidebar_label: jaxrs-cxf-extended |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index bae14d53f14..bcb14352a97 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -36,6 +36,7 @@ sidebar_label: jaxrs-cxf |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index 16419d4bf5f..ee1782b7337 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -36,6 +36,7 @@ sidebar_label: jaxrs-jersey |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 615d5702600..baa90886e53 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -36,6 +36,7 @@ sidebar_label: jaxrs-resteasy-eap |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index 885caa88962..62e6fc5254e 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -36,6 +36,7 @@ sidebar_label: jaxrs-resteasy |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index e70657aa2fc..1051b458ecd 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -36,6 +36,7 @@ sidebar_label: jaxrs-spec |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| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/kotlin-server.md b/docs/generators/kotlin-server.md index eb66b331ffa..d84d2857173 100644 --- a/docs/generators/kotlin-server.md +++ b/docs/generators/kotlin-server.md @@ -15,6 +15,7 @@ sidebar_label: kotlin-server |serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi| |parcelizeModels|toggle "@Parcelize" for generated models| |null| |serializableModel|boolean - toggle "implements Serializable" for generated models| |null| +|modelMutable|Create mutable models| |false| |library|library template (sub-template)|
**ktor**
ktor framework
|ktor| |featureAutoHead|Automatically provide responses to HEAD requests for existing routes that have the GET verb defined.| |true| |featureConditionalHeaders|Avoid sending content if client already has same content, by checking ETag or LastModified properties.| |false| diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index a93641a10ce..5d67f4b8ec4 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -15,6 +15,7 @@ sidebar_label: kotlin-spring |serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi| |parcelizeModels|toggle "@Parcelize" for generated models| |null| |serializableModel|boolean - toggle "implements Serializable" for generated models| |null| +|modelMutable|Create mutable models| |false| |title|server title name or client service name| |OpenAPI Kotlin Spring| |basePackage|base package (invokerPackage) for generated code| |org.openapitools| |serverPort|configuration the port in which the sever is to run on| |8080| diff --git a/docs/generators/kotlin-vertx.md b/docs/generators/kotlin-vertx.md index 6c50f140b78..496f1a7ef0d 100644 --- a/docs/generators/kotlin-vertx.md +++ b/docs/generators/kotlin-vertx.md @@ -15,3 +15,4 @@ sidebar_label: kotlin-vertx |serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi| |parcelizeModels|toggle "@Parcelize" for generated models| |null| |serializableModel|boolean - toggle "implements Serializable" for generated models| |null| +|modelMutable|Create mutable models| |false| diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index ec9a4e0332a..d64fd3964ff 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -15,6 +15,7 @@ sidebar_label: kotlin |serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi| |parcelizeModels|toggle "@Parcelize" for generated models| |null| |serializableModel|boolean - toggle "implements Serializable" for generated models| |null| +|modelMutable|Create mutable models| |false| |dateLibrary|Option. Date library to use|
**string**
String
**java8**
Java 8 native JSR310 (jvm only)
**threetenbp**
Threetenbp (jvm only)
|java8| |collectionType|Option. Collection type to use|
**array**
kotlin.Array
**list**
kotlin.collections.List
|array| |library|Library template (sub-template) to use|
**jvm-okhttp4**
[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.
**jvm-okhttp3**
Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0.
**multiplatform**
Platform: Kotlin multiplatform. HTTP client: Ktor 1.2.4. JSON processing: Kotlinx Serialization: 0.12.0.
|jvm-okhttp4| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index c122ddcb4de..793dfbbaa69 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -36,6 +36,7 @@ sidebar_label: spring |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| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| @@ -49,7 +50,7 @@ sidebar_label: spring |skipDefaultInterface|Whether to generate default implementations for java8 interfaces| |false| |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| +|responseWrapper|wrap the responses in given type (Future, Callable, CompletableFuture,ListenableFuture, DeferredResult, HystrixCommand, RxObservable, RxSingle or fully qualified type)| |null| |virtualService|Generates the virtual service. For more details refer - https://github.com/elan-venture/virtualan/wiki| |false| |useTags|use tags for creating interface and controller classnames| |false| |useBeanValidation|Use BeanValidation API annotations| |true| diff --git a/docs/generators/swift4.md b/docs/generators/swift4.md index 3136fb0a7c6..5abbc3658cf 100644 --- a/docs/generators/swift4.md +++ b/docs/generators/swift4.md @@ -10,7 +10,8 @@ sidebar_label: swift4 |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| |projectName|Project name in Xcode| |null| -|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available.| |null| +|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result are available.| |null| +|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null| |unwrapRequired|Treat 'required' properties in response as non-optional (which would crash the app if api returns null as opposed to required option specified in json schema| |null| |objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null| |podSource|Source information used for Podspec| |null| diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Validate.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Validate.java index 8520114fd46..4011a448881 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Validate.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Validate.java @@ -22,11 +22,14 @@ import io.airlift.airline.Option; import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.media.ComposedSchema; +import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.core.models.SwaggerParseResult; import org.openapitools.codegen.utils.ModelUtils; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; @Command(name = "validate", description = "Validate specification") @@ -58,6 +61,21 @@ public class Validate implements Runnable { if (unusedModels != null) { unusedModels.forEach(name -> warnings.add("Unused model: " + name)); } + + // check for loosely defined oneOf extension requirements. + // This is a recommendation because the 3.0.x spec is not clear enough on usage of oneOf. + // see https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.9.2.1.3 and the OAS section on 'Composition and Inheritance'. + Map schemas = ModelUtils.getSchemas(specification); + schemas.forEach((key, schema) -> { + if (schema instanceof ComposedSchema) { + final ComposedSchema composed = (ComposedSchema) schema; + if (composed.getOneOf() != null && composed.getOneOf().size() > 0) { + if (composed.getProperties() != null && composed.getProperties().size() >= 1 && composed.getProperties().get("discriminator") == null) { + warnings.add("Schema (oneOf) should not contain properties: " + key); + } + } + } + }); } } diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index 1ba8c136a66..806e7734efa 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -45,7 +45,7 @@ compileJava.dependsOn tasks.openApiGenerate [source,group] ---- plugins { - id "org.openapi.generator" version "4.2.2-SNAPSHOT" + id "org.openapi.generator" version "4.2.3-SNAPSHOT" } ---- 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 9a2f6139045..23270faca3c 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md @@ -18,5 +18,5 @@ gradle generateGoWithInvalidSpec The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example: ```bash -gradle -PopenApiGeneratorVersion=4.2.2-SNAPSHOT openApiValidate +gradle -PopenApiGeneratorVersion=4.2.3-SNAPSHOT openApiValidate ``` diff --git a/modules/openapi-generator-maven-plugin/README.md b/modules/openapi-generator-maven-plugin/README.md index 3e10c5bc67b..fd6c8e25ca9 100644 --- a/modules/openapi-generator-maven-plugin/README.md +++ b/modules/openapi-generator-maven-plugin/README.md @@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase) org.openapitools openapi-generator-maven-plugin - 4.2.2-SNAPSHOT + 4.2.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 7c00f5680f9..c0416bfe6b3 100644 --- a/modules/openapi-generator-maven-plugin/examples/java-client.xml +++ b/modules/openapi-generator-maven-plugin/examples/java-client.xml @@ -13,7 +13,7 @@ org.openapitools openapi-generator-maven-plugin - 4.2.2-SNAPSHOT + 4.2.3-SNAPSHOT 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 1ffead35a08..81f008570aa 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 @@ -13,7 +13,7 @@ org.openapitools openapi-generator-maven-plugin - 4.2.2-SNAPSHOT + 4.2.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 ba2ee84c6f5..2ec02ae10f4 100644 --- a/modules/openapi-generator-maven-plugin/examples/non-java.xml +++ b/modules/openapi-generator-maven-plugin/examples/non-java.xml @@ -13,7 +13,7 @@ org.openapitools openapi-generator-maven-plugin - 4.2.2-SNAPSHOT + 4.2.3-SNAPSHOT diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index f16ab36a547..752e4490426 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -200,7 +200,7 @@ 1.0.2 2.9.10 2.9.10 - 1.3.41 + 1.3.60 @@ -301,7 +301,7 @@ org.mockito mockito-core - 3.1.0 + 3.2.0 test @@ -347,6 +347,11 @@ ${kotlin-version} test + + net.java.dev.jna + jna + 5.5.0 + 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 71716ba25c2..2a6f32028ad 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 @@ -30,12 +30,12 @@ public class ClientOptInput { private List auths; public ClientOptInput openAPI(OpenAPI openAPI) { - this.openAPI = openAPI; + this.setOpenAPI(openAPI); return this; } public ClientOptInput config(CodegenConfig codegenConfig) { - this.config = codegenConfig; + this.setConfig(codegenConfig); return this; } @@ -72,6 +72,10 @@ public class ClientOptInput { @Deprecated public void setConfig(CodegenConfig config) { this.config = config; + // TODO: ClientOptInputs needs to be retired + if (this.openAPI != null) { + this.config.setOpenAPI(this.openAPI); + } } @Deprecated @@ -86,5 +90,9 @@ public class ClientOptInput { @Deprecated public void setOpenAPI(OpenAPI openAPI) { this.openAPI = openAPI; + // TODO: ClientOptInputs needs to be retired + if (this.config != null) { + this.config.setOpenAPI(this.openAPI); + } } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java index 3dcf7cfbeae..982433c64de 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java @@ -44,6 +44,7 @@ public class CodegenCallback { public int hashCode() { return Objects.hash(expression, hasMore, requests, vendorExtensions); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -64,10 +65,12 @@ public class CodegenCallback { return Objects.equals(that.name, name) && Objects.equals(that.hasMore, hasMore) && Objects.equals(that.urls, urls) && Objects.equals(that.vendorExtensions, vendorExtensions); } + @Override public int hashCode() { return Objects.hash(name, hasMore, urls, vendorExtensions); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -77,4 +80,6 @@ public class CodegenCallback { sb.append("}"); return sb.toString(); } + + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java index 1758abb2a1c..9b548e8b549 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java @@ -91,21 +91,25 @@ public class CodegenDiscriminator { if (o == null || getClass() != o.getClass()) return false; CodegenDiscriminator that = (CodegenDiscriminator) o; return Objects.equals(propertyName, that.propertyName) && + Objects.equals(propertyBaseName, that.propertyBaseName) && Objects.equals(mapping, that.mapping) && Objects.equals(mappedModels, that.mappedModels); } @Override public int hashCode() { - return Objects.hash(propertyName, mapping, mappedModels); + + return Objects.hash(propertyName, propertyBaseName, mapping, mappedModels); } @Override public String toString() { - return new ToStringBuilder(this) - .append("propertyName", propertyName) - .append("mapping", mapping) - .append("mappedModels", mappedModels) - .toString(); + final StringBuffer sb = new StringBuffer("CodegenDiscriminator{"); + sb.append("propertyName='").append(propertyName).append('\''); + sb.append(", propertyBaseName='").append(propertyBaseName).append('\''); + sb.append(", mapping=").append(mapping); + sb.append(", mappedModels=").append(mappedModels); + sb.append('}'); + return sb.toString(); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java index 876162afe13..a7289087ef5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java @@ -70,157 +70,6 @@ public class CodegenModel { //The type of the value from additional properties. Used in map like objects. public String additionalPropertiesType; - @Override - public String toString() { - return new ToStringBuilder(this) - .append("parent", parent) - .append("parentSchema", parentSchema) - .append("interfaces", interfaces) - .append("parentModel", parentModel) - .append("interfaceModels", interfaceModels) - .append("children", children) - .append("name", name) - .append("classname", classname) - .append("title", title) - .append("description", description) - .append("classVarName", classVarName) - .append("modelJson", modelJson) - .append("dataType", dataType) - .append("xmlPrefix", xmlPrefix) - .append("xmlNamespace", xmlNamespace) - .append("xmlName", xmlName) - .append("classFilename", classFilename) - .append("unescapedDescription", unescapedDescription) - .append("discriminator", discriminator) - .append("defaultValue", defaultValue) - .append("arrayModelType", arrayModelType) - .append("isAlias", isAlias) - .append("isString", isString) - .append("isNumeric", isNumeric) - .append("isInteger", isInteger) - .append("isLong", isLong) - .append("isNumber", isNumber) - .append("isFloat", isFloat) - .append("isDouble", isDouble) - .append("vars", vars) - .append("requiredVars", requiredVars) - .append("optionalVars", optionalVars) - .append("readOnlyVars", readOnlyVars) - .append("readWriteVars", readWriteVars) - .append("allVars", allVars) - .append("parentVars", parentVars) - .append("allowableValues", allowableValues) - .append("mandatory", mandatory) - .append("allMandatory", allMandatory) - .append("imports", imports) - .append("hasVars", hasVars) - .append("emptyVars", emptyVars) - .append("hasMoreModels", hasMoreModels) - .append("hasEnums", hasEnums) - .append("isEnum", isEnum) - .append("isNullable", isNullable) - .append("hasRequired", hasRequired) - .append("hasOptional", hasOptional) - .append("isArrayModel", isArrayModel) - .append("hasChildren", hasChildren) - .append("isMapModel", isMapModel) - .append("hasOnlyReadOnly", hasOnlyReadOnly) - .append("externalDocumentation", externalDocumentation) - .append("vendorExtensions", vendorExtensions) - .append("additionalPropertiesType", additionalPropertiesType) - .toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CodegenModel that = (CodegenModel) o; - - return Objects.equals(parent, that.parent) && - Objects.equals(parentSchema, that.parentSchema) && - Objects.equals(interfaces, that.interfaces) && - Objects.equals(allParents, that.allParents) && - Objects.equals(parentModel, that.parentModel) && - Objects.equals(interfaceModels, that.interfaceModels) && - Objects.equals(name, that.name) && - Objects.equals(classname, that.classname) && - Objects.equals(title, that.title) && - Objects.equals(description, that.description) && - Objects.equals(classVarName, that.classVarName) && - Objects.equals(modelJson, that.modelJson) && - Objects.equals(dataType, that.dataType) && - Objects.equals(xmlPrefix, that.xmlPrefix) && - Objects.equals(xmlNamespace, that.xmlNamespace) && - Objects.equals(xmlName, that.xmlName) && - Objects.equals(classFilename, that.classFilename) && - Objects.equals(unescapedDescription, that.unescapedDescription) && - Objects.equals(discriminator, that.discriminator) && - Objects.equals(defaultValue, that.defaultValue) && - Objects.equals(vars, that.vars) && - Objects.equals(requiredVars, that.requiredVars) && - Objects.equals(optionalVars, that.optionalVars) && - Objects.equals(allVars, that.allVars) && - Objects.equals(allowableValues, that.allowableValues) && - Objects.equals(mandatory, that.mandatory) && - Objects.equals(allMandatory, that.allMandatory) && - Objects.equals(imports, that.imports) && - Objects.equals(hasVars, that.hasVars) && - Objects.equals(emptyVars, that.emptyVars) && - Objects.equals(hasMoreModels, that.hasMoreModels) && - Objects.equals(hasEnums, that.hasEnums) && - Objects.equals(isEnum, that.isEnum) && - Objects.equals(externalDocumentation, that.externalDocumentation) && - Objects.equals(hasOnlyReadOnly, that.hasOnlyReadOnly) && - Objects.equals(hasChildren, that.hasChildren) && - Objects.equals(parentVars, that.parentVars) && - Objects.equals(vendorExtensions, that.vendorExtensions); - } - - @Override - public int hashCode() { - return Objects.hash( - parent, - parentSchema, - interfaces, - allParents, - parentModel, - interfaceModels, - name, - classname, - title, - description, - classVarName, - modelJson, - dataType, - xmlPrefix, - xmlNamespace, - xmlName, - classFilename, - unescapedDescription, - discriminator, - defaultValue, - vars, - requiredVars, - optionalVars, - allVars, - allowableValues, - mandatory, - allMandatory, - imports, - hasVars, - emptyVars, - hasMoreModels, - hasEnums, - isEnum, - externalDocumentation, - vendorExtensions, - hasOnlyReadOnly, - hasChildren, - parentVars); - } - public String getParent() { return parent; } @@ -601,4 +450,149 @@ public class CodegenModel { } } } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenModel that = (CodegenModel) o; + return isAlias == that.isAlias && + isString == that.isString && + isInteger == that.isInteger && + isLong == that.isLong && + isNumber == that.isNumber && + isNumeric == that.isNumeric && + isFloat == that.isFloat && + isDouble == that.isDouble && + hasVars == that.hasVars && + emptyVars == that.emptyVars && + hasMoreModels == that.hasMoreModels && + hasEnums == that.hasEnums && + isEnum == that.isEnum && + isNullable == that.isNullable && + hasRequired == that.hasRequired && + hasOptional == that.hasOptional && + isArrayModel == that.isArrayModel && + hasChildren == that.hasChildren && + isMapModel == that.isMapModel && + hasOnlyReadOnly == that.hasOnlyReadOnly && + Objects.equals(parent, that.parent) && + Objects.equals(parentSchema, that.parentSchema) && + Objects.equals(interfaces, that.interfaces) && + Objects.equals(allParents, that.allParents) && + Objects.equals(parentModel, that.parentModel) && + Objects.equals(interfaceModels, that.interfaceModels) && + Objects.equals(children, that.children) && + Objects.equals(anyOf, that.anyOf) && + Objects.equals(oneOf, that.oneOf) && + Objects.equals(allOf, that.allOf) && + Objects.equals(name, that.name) && + Objects.equals(classname, that.classname) && + Objects.equals(title, that.title) && + Objects.equals(description, that.description) && + Objects.equals(classVarName, that.classVarName) && + Objects.equals(modelJson, that.modelJson) && + Objects.equals(dataType, that.dataType) && + Objects.equals(xmlPrefix, that.xmlPrefix) && + Objects.equals(xmlNamespace, that.xmlNamespace) && + Objects.equals(xmlName, that.xmlName) && + Objects.equals(classFilename, that.classFilename) && + Objects.equals(unescapedDescription, that.unescapedDescription) && + Objects.equals(discriminator, that.discriminator) && + Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(arrayModelType, that.arrayModelType) && + Objects.equals(vars, that.vars) && + Objects.equals(allVars, that.allVars) && + Objects.equals(requiredVars, that.requiredVars) && + Objects.equals(optionalVars, that.optionalVars) && + Objects.equals(readOnlyVars, that.readOnlyVars) && + Objects.equals(readWriteVars, that.readWriteVars) && + Objects.equals(parentVars, that.parentVars) && + Objects.equals(allowableValues, that.allowableValues) && + Objects.equals(mandatory, that.mandatory) && + Objects.equals(allMandatory, that.allMandatory) && + Objects.equals(imports, that.imports) && + Objects.equals(externalDocumentation, that.externalDocumentation) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(additionalPropertiesType, that.additionalPropertiesType); + } + + @Override + public int hashCode() { + + return Objects.hash(parent, parentSchema, interfaces, allParents, parentModel, interfaceModels, children, + anyOf, oneOf, allOf, name, classname, title, description, classVarName, modelJson, dataType, + xmlPrefix, xmlNamespace, xmlName, classFilename, unescapedDescription, discriminator, defaultValue, + arrayModelType, isAlias, isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, + vars, allVars, requiredVars, optionalVars, readOnlyVars, readWriteVars, parentVars, allowableValues, + mandatory, allMandatory, imports, hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, isNullable, + hasRequired, hasOptional, isArrayModel, hasChildren, isMapModel, hasOnlyReadOnly, + externalDocumentation, vendorExtensions, additionalPropertiesType); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenModel{"); + sb.append("parent='").append(parent).append('\''); + sb.append(", parentSchema='").append(parentSchema).append('\''); + sb.append(", interfaces=").append(interfaces); + sb.append(", allParents=").append(allParents); + sb.append(", parentModel=").append(parentModel); + sb.append(", interfaceModels=").append(interfaceModels); + sb.append(", children=").append(children); + sb.append(", anyOf=").append(anyOf); + sb.append(", oneOf=").append(oneOf); + sb.append(", allOf=").append(allOf); + sb.append(", name='").append(name).append('\''); + sb.append(", classname='").append(classname).append('\''); + sb.append(", title='").append(title).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", classVarName='").append(classVarName).append('\''); + sb.append(", modelJson='").append(modelJson).append('\''); + sb.append(", dataType='").append(dataType).append('\''); + sb.append(", xmlPrefix='").append(xmlPrefix).append('\''); + sb.append(", xmlNamespace='").append(xmlNamespace).append('\''); + sb.append(", xmlName='").append(xmlName).append('\''); + sb.append(", classFilename='").append(classFilename).append('\''); + sb.append(", unescapedDescription='").append(unescapedDescription).append('\''); + sb.append(", discriminator=").append(discriminator); + sb.append(", defaultValue='").append(defaultValue).append('\''); + sb.append(", arrayModelType='").append(arrayModelType).append('\''); + sb.append(", isAlias=").append(isAlias); + sb.append(", isString=").append(isString); + sb.append(", isInteger=").append(isInteger); + sb.append(", isLong=").append(isLong); + sb.append(", isNumber=").append(isNumber); + sb.append(", isNumeric=").append(isNumeric); + sb.append(", isFloat=").append(isFloat); + sb.append(", isDouble=").append(isDouble); + sb.append(", vars=").append(vars); + sb.append(", allVars=").append(allVars); + sb.append(", requiredVars=").append(requiredVars); + sb.append(", optionalVars=").append(optionalVars); + sb.append(", readOnlyVars=").append(readOnlyVars); + sb.append(", readWriteVars=").append(readWriteVars); + sb.append(", parentVars=").append(parentVars); + sb.append(", allowableValues=").append(allowableValues); + sb.append(", mandatory=").append(mandatory); + sb.append(", allMandatory=").append(allMandatory); + sb.append(", imports=").append(imports); + sb.append(", hasVars=").append(hasVars); + sb.append(", emptyVars=").append(emptyVars); + sb.append(", hasMoreModels=").append(hasMoreModels); + sb.append(", hasEnums=").append(hasEnums); + sb.append(", isEnum=").append(isEnum); + sb.append(", isNullable=").append(isNullable); + sb.append(", hasRequired=").append(hasRequired); + sb.append(", hasOptional=").append(hasOptional); + sb.append(", isArrayModel=").append(isArrayModel); + sb.append(", hasChildren=").append(hasChildren); + sb.append(", isMapModel=").append(isMapModel); + sb.append(", hasOnlyReadOnly=").append(hasOnlyReadOnly); + sb.append(", externalDocumentation=").append(externalDocumentation); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", additionalPropertiesType='").append(additionalPropertiesType).append('\''); + sb.append('}'); + return sb.toString(); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java index 583b1cbab1c..2f839171045 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java @@ -244,134 +244,160 @@ public class CodegenOperation { @Override public String toString() { - return String.format(Locale.ROOT, "%s(%s)", baseName, path); + final StringBuffer sb = new StringBuffer("CodegenOperation{"); + sb.append("responseHeaders=").append(responseHeaders); + sb.append(", hasAuthMethods=").append(hasAuthMethods); + sb.append(", hasConsumes=").append(hasConsumes); + sb.append(", hasProduces=").append(hasProduces); + sb.append(", hasParams=").append(hasParams); + sb.append(", hasOptionalParams=").append(hasOptionalParams); + sb.append(", hasRequiredParams=").append(hasRequiredParams); + sb.append(", returnTypeIsPrimitive=").append(returnTypeIsPrimitive); + sb.append(", returnSimpleType=").append(returnSimpleType); + sb.append(", subresourceOperation=").append(subresourceOperation); + sb.append(", isMapContainer=").append(isMapContainer); + sb.append(", isListContainer=").append(isListContainer); + sb.append(", isMultipart=").append(isMultipart); + sb.append(", hasMore=").append(hasMore); + sb.append(", isResponseBinary=").append(isResponseBinary); + sb.append(", isResponseFile=").append(isResponseFile); + sb.append(", hasReference=").append(hasReference); + sb.append(", isRestfulIndex=").append(isRestfulIndex); + sb.append(", isRestfulShow=").append(isRestfulShow); + sb.append(", isRestfulCreate=").append(isRestfulCreate); + sb.append(", isRestfulUpdate=").append(isRestfulUpdate); + sb.append(", isRestfulDestroy=").append(isRestfulDestroy); + sb.append(", isRestful=").append(isRestful); + sb.append(", isDeprecated=").append(isDeprecated); + sb.append(", isCallbackRequest=").append(isCallbackRequest); + sb.append(", path='").append(path).append('\''); + sb.append(", operationId='").append(operationId).append('\''); + sb.append(", returnType='").append(returnType).append('\''); + sb.append(", httpMethod='").append(httpMethod).append('\''); + sb.append(", returnBaseType='").append(returnBaseType).append('\''); + sb.append(", returnContainer='").append(returnContainer).append('\''); + sb.append(", summary='").append(summary).append('\''); + sb.append(", unescapedNotes='").append(unescapedNotes).append('\''); + sb.append(", notes='").append(notes).append('\''); + sb.append(", baseName='").append(baseName).append('\''); + sb.append(", defaultResponse='").append(defaultResponse).append('\''); + sb.append(", discriminator=").append(discriminator); + sb.append(", consumes=").append(consumes); + sb.append(", produces=").append(produces); + sb.append(", prioritizedContentTypes=").append(prioritizedContentTypes); + sb.append(", servers=").append(servers); + sb.append(", bodyParam=").append(bodyParam); + sb.append(", allParams=").append(allParams); + sb.append(", bodyParams=").append(bodyParams); + sb.append(", pathParams=").append(pathParams); + sb.append(", queryParams=").append(queryParams); + sb.append(", headerParams=").append(headerParams); + sb.append(", formParams=").append(formParams); + sb.append(", cookieParams=").append(cookieParams); + sb.append(", requiredParams=").append(requiredParams); + sb.append(", optionalParams=").append(optionalParams); + sb.append(", authMethods=").append(authMethods); + sb.append(", tags=").append(tags); + sb.append(", responses=").append(responses); + sb.append(", callbacks=").append(callbacks); + sb.append(", imports=").append(imports); + sb.append(", examples=").append(examples); + sb.append(", requestBodyExamples=").append(requestBodyExamples); + sb.append(", externalDocs=").append(externalDocs); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", nickname='").append(nickname).append('\''); + sb.append(", operationIdOriginal='").append(operationIdOriginal).append('\''); + sb.append(", operationIdLowerCase='").append(operationIdLowerCase).append('\''); + sb.append(", operationIdCamelCase='").append(operationIdCamelCase).append('\''); + sb.append(", operationIdSnakeCase='").append(operationIdSnakeCase).append('\''); + sb.append('}'); + return sb.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - CodegenOperation that = (CodegenOperation) o; - - return Objects.equals(responseHeaders, that.responseHeaders) && - Objects.equals(hasAuthMethods, that.hasAuthMethods) && - Objects.equals(hasConsumes, that.hasConsumes) && - Objects.equals(hasProduces, that.hasProduces) && - Objects.equals(hasParams, that.hasParams) && - Objects.equals(hasOptionalParams, that.hasOptionalParams) && - Objects.equals(returnTypeIsPrimitive, that.returnTypeIsPrimitive) && - Objects.equals(returnSimpleType, that.returnSimpleType) && - Objects.equals(subresourceOperation, that.subresourceOperation) && - Objects.equals(isMapContainer, that.isMapContainer) && - Objects.equals(isListContainer, that.isListContainer) && - Objects.equals(isMultipart, that.isMultipart) && - Objects.equals(hasMore, that.hasMore) && - Objects.equals(isResponseBinary, that.isResponseBinary) && - Objects.equals(hasReference, that.hasReference) && - Objects.equals(isResponseFile, that.isResponseFile) && - Objects.equals(isDeprecated, that.isDeprecated) && - Objects.equals(isCallbackRequest, that.isCallbackRequest) && - Objects.equals(path, that.path) && - Objects.equals(operationId, that.operationId) && - Objects.equals(returnType, that.returnType) && - Objects.equals(httpMethod, that.httpMethod) && - Objects.equals(returnBaseType, that.returnBaseType) && - Objects.equals(returnContainer, that.returnContainer) && - Objects.equals(summary, that.summary) && - Objects.equals(unescapedNotes, that.unescapedNotes) && - Objects.equals(notes, that.notes) && - Objects.equals(baseName, that.baseName) && - Objects.equals(defaultResponse, that.defaultResponse) && - Objects.equals(discriminator, that.discriminator) && - Objects.equals(consumes, that.consumes) && - Objects.equals(produces, that.produces) && - Objects.equals(servers, that.servers) && - Objects.equals(bodyParam, that.bodyParam) && - Objects.equals(allParams, that.allParams) && - Objects.equals(bodyParams, that.bodyParams) && - Objects.equals(pathParams, that.pathParams) && - Objects.equals(queryParams, that.queryParams) && - Objects.equals(headerParams, that.headerParams) && - Objects.equals(formParams, that.formParams) && - Objects.equals(cookieParams, that.cookieParams) && - Objects.equals(requiredParams, that.requiredParams) && - Objects.equals(optionalParams, that.optionalParams) && - Objects.equals(authMethods, that.authMethods) && - Objects.equals(tags, that.tags) && - Objects.equals(responses, that.responses) && - Objects.equals(callbacks, that.callbacks) && - Objects.equals(imports, that.imports) && - Objects.equals(examples, that.examples) && - Objects.equals(externalDocs, that.externalDocs) && - Objects.equals(vendorExtensions, that.vendorExtensions) && - Objects.equals(nickname, that.nickname) && - Objects.equals(prioritizedContentTypes, that.prioritizedContentTypes) && - Objects.equals(operationIdOriginal, that.operationIdOriginal) && - Objects.equals(operationIdLowerCase, that.operationIdLowerCase) && - Objects.equals(operationIdCamelCase, that.operationIdCamelCase); + return hasAuthMethods == that.hasAuthMethods && + hasConsumes == that.hasConsumes && + hasProduces == that.hasProduces && + hasParams == that.hasParams && + hasOptionalParams == that.hasOptionalParams && + hasRequiredParams == that.hasRequiredParams && + returnTypeIsPrimitive == that.returnTypeIsPrimitive && + returnSimpleType == that.returnSimpleType && + subresourceOperation == that.subresourceOperation && + isMapContainer == that.isMapContainer && + isListContainer == that.isListContainer && + isMultipart == that.isMultipart && + hasMore == that.hasMore && + isResponseBinary == that.isResponseBinary && + isResponseFile == that.isResponseFile && + hasReference == that.hasReference && + isRestfulIndex == that.isRestfulIndex && + isRestfulShow == that.isRestfulShow && + isRestfulCreate == that.isRestfulCreate && + isRestfulUpdate == that.isRestfulUpdate && + isRestfulDestroy == that.isRestfulDestroy && + isRestful == that.isRestful && + isDeprecated == that.isDeprecated && + isCallbackRequest == that.isCallbackRequest && + Objects.equals(responseHeaders, that.responseHeaders) && + Objects.equals(path, that.path) && + Objects.equals(operationId, that.operationId) && + Objects.equals(returnType, that.returnType) && + Objects.equals(httpMethod, that.httpMethod) && + Objects.equals(returnBaseType, that.returnBaseType) && + Objects.equals(returnContainer, that.returnContainer) && + Objects.equals(summary, that.summary) && + Objects.equals(unescapedNotes, that.unescapedNotes) && + Objects.equals(notes, that.notes) && + Objects.equals(baseName, that.baseName) && + Objects.equals(defaultResponse, that.defaultResponse) && + Objects.equals(discriminator, that.discriminator) && + Objects.equals(consumes, that.consumes) && + Objects.equals(produces, that.produces) && + Objects.equals(prioritizedContentTypes, that.prioritizedContentTypes) && + Objects.equals(servers, that.servers) && + Objects.equals(bodyParam, that.bodyParam) && + Objects.equals(allParams, that.allParams) && + Objects.equals(bodyParams, that.bodyParams) && + Objects.equals(pathParams, that.pathParams) && + Objects.equals(queryParams, that.queryParams) && + Objects.equals(headerParams, that.headerParams) && + Objects.equals(formParams, that.formParams) && + Objects.equals(cookieParams, that.cookieParams) && + Objects.equals(requiredParams, that.requiredParams) && + Objects.equals(optionalParams, that.optionalParams) && + Objects.equals(authMethods, that.authMethods) && + Objects.equals(tags, that.tags) && + Objects.equals(responses, that.responses) && + Objects.equals(callbacks, that.callbacks) && + Objects.equals(imports, that.imports) && + Objects.equals(examples, that.examples) && + Objects.equals(requestBodyExamples, that.requestBodyExamples) && + Objects.equals(externalDocs, that.externalDocs) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(nickname, that.nickname) && + Objects.equals(operationIdOriginal, that.operationIdOriginal) && + Objects.equals(operationIdLowerCase, that.operationIdLowerCase) && + Objects.equals(operationIdCamelCase, that.operationIdCamelCase) && + Objects.equals(operationIdSnakeCase, that.operationIdSnakeCase); } @Override public int hashCode() { - return Objects.hash( - responseHeaders, - hasAuthMethods, - hasConsumes, - hasProduces, - hasParams, - hasOptionalParams, - returnTypeIsPrimitive, - returnSimpleType, - subresourceOperation, - isMapContainer, - isListContainer, - isMultipart, - hasMore, - isResponseBinary, - isResponseFile, - hasReference, - isDeprecated, - isCallbackRequest, - path, - operationId, - returnType, - httpMethod, - returnBaseType, - returnContainer, - summary, - unescapedNotes, - notes, - baseName, - defaultResponse, - discriminator, - consumes, - produces, - servers, - bodyParam, - allParams, - bodyParams, - pathParams, - queryParams, - headerParams, - formParams, - cookieParams, - requiredParams, - optionalParams, - authMethods, - tags, - responses, - callbacks, - imports, - examples, - externalDocs, - vendorExtensions, - nickname, - prioritizedContentTypes, - operationIdOriginal, - operationIdLowerCase, - operationIdCamelCase); + + return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams, + hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMapContainer, + isListContainer, isMultipart, hasMore, isResponseBinary, isResponseFile, hasReference, isRestfulIndex, + isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, isRestful, isDeprecated, + isCallbackRequest, path, operationId, returnType, httpMethod, returnBaseType, returnContainer, + summary, unescapedNotes, notes, baseName, defaultResponse, discriminator, consumes, produces, + prioritizedContentTypes, servers, bodyParam, allParams, bodyParams, pathParams, queryParams, + headerParams, formParams, cookieParams, requiredParams, optionalParams, authMethods, tags, + responses, callbacks, imports, examples, requestBodyExamples, externalDocs, vendorExtensions, + nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase, operationIdSnakeCase); } - - } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java index b42f6119996..15979f7ad61 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java @@ -43,6 +43,167 @@ public class CodegenParameter { public CodegenProperty mostInnerItems; public Map vendorExtensions = new HashMap(); public boolean hasValidation; + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenParameter{"); + sb.append("isFormParam=").append(isFormParam); + sb.append(", isQueryParam=").append(isQueryParam); + sb.append(", isPathParam=").append(isPathParam); + sb.append(", isHeaderParam=").append(isHeaderParam); + sb.append(", isCookieParam=").append(isCookieParam); + sb.append(", isBodyParam=").append(isBodyParam); + sb.append(", hasMore=").append(hasMore); + sb.append(", isContainer=").append(isContainer); + sb.append(", secondaryParam=").append(secondaryParam); + sb.append(", isCollectionFormatMulti=").append(isCollectionFormatMulti); + sb.append(", isPrimitiveType=").append(isPrimitiveType); + sb.append(", isModel=").append(isModel); + sb.append(", isExplode=").append(isExplode); + sb.append(", baseName='").append(baseName).append('\''); + sb.append(", paramName='").append(paramName).append('\''); + sb.append(", dataType='").append(dataType).append('\''); + sb.append(", datatypeWithEnum='").append(datatypeWithEnum).append('\''); + sb.append(", dataFormat='").append(dataFormat).append('\''); + sb.append(", collectionFormat='").append(collectionFormat).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", unescapedDescription='").append(unescapedDescription).append('\''); + sb.append(", baseType='").append(baseType).append('\''); + sb.append(", defaultValue='").append(defaultValue).append('\''); + sb.append(", enumName='").append(enumName).append('\''); + sb.append(", style='").append(style).append('\''); + sb.append(", example='").append(example).append('\''); + sb.append(", jsonSchema='").append(jsonSchema).append('\''); + sb.append(", isString=").append(isString); + sb.append(", isNumeric=").append(isNumeric); + sb.append(", isInteger=").append(isInteger); + sb.append(", isLong=").append(isLong); + sb.append(", isNumber=").append(isNumber); + sb.append(", isFloat=").append(isFloat); + sb.append(", isDouble=").append(isDouble); + sb.append(", isByteArray=").append(isByteArray); + sb.append(", isBinary=").append(isBinary); + sb.append(", isBoolean=").append(isBoolean); + sb.append(", isDate=").append(isDate); + sb.append(", isDateTime=").append(isDateTime); + sb.append(", isUuid=").append(isUuid); + sb.append(", isUri=").append(isUri); + sb.append(", isEmail=").append(isEmail); + sb.append(", isFreeFormObject=").append(isFreeFormObject); + sb.append(", isListContainer=").append(isListContainer); + sb.append(", isMapContainer=").append(isMapContainer); + sb.append(", isFile=").append(isFile); + sb.append(", isEnum=").append(isEnum); + sb.append(", _enum=").append(_enum); + sb.append(", allowableValues=").append(allowableValues); + sb.append(", items=").append(items); + sb.append(", mostInnerItems=").append(mostInnerItems); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", hasValidation=").append(hasValidation); + sb.append(", isNullable=").append(isNullable); + sb.append(", required=").append(required); + sb.append(", maximum='").append(maximum).append('\''); + sb.append(", exclusiveMaximum=").append(exclusiveMaximum); + sb.append(", minimum='").append(minimum).append('\''); + sb.append(", exclusiveMinimum=").append(exclusiveMinimum); + sb.append(", maxLength=").append(maxLength); + sb.append(", minLength=").append(minLength); + sb.append(", pattern='").append(pattern).append('\''); + sb.append(", maxItems=").append(maxItems); + sb.append(", minItems=").append(minItems); + sb.append(", uniqueItems=").append(uniqueItems); + sb.append(", multipleOf=").append(multipleOf); + sb.append('}'); + return sb.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenParameter that = (CodegenParameter) o; + return isFormParam == that.isFormParam && + isQueryParam == that.isQueryParam && + isPathParam == that.isPathParam && + isHeaderParam == that.isHeaderParam && + isCookieParam == that.isCookieParam && + isBodyParam == that.isBodyParam && + hasMore == that.hasMore && + isContainer == that.isContainer && + secondaryParam == that.secondaryParam && + isCollectionFormatMulti == that.isCollectionFormatMulti && + isPrimitiveType == that.isPrimitiveType && + isModel == that.isModel && + isExplode == that.isExplode && + isString == that.isString && + isNumeric == that.isNumeric && + isInteger == that.isInteger && + isLong == that.isLong && + isNumber == that.isNumber && + isFloat == that.isFloat && + isDouble == that.isDouble && + isByteArray == that.isByteArray && + isBinary == that.isBinary && + isBoolean == that.isBoolean && + isDate == that.isDate && + isDateTime == that.isDateTime && + isUuid == that.isUuid && + isUri == that.isUri && + isEmail == that.isEmail && + isFreeFormObject == that.isFreeFormObject && + isListContainer == that.isListContainer && + isMapContainer == that.isMapContainer && + isFile == that.isFile && + isEnum == that.isEnum && + hasValidation == that.hasValidation && + isNullable == that.isNullable && + required == that.required && + exclusiveMaximum == that.exclusiveMaximum && + exclusiveMinimum == that.exclusiveMinimum && + uniqueItems == that.uniqueItems && + Objects.equals(baseName, that.baseName) && + Objects.equals(paramName, that.paramName) && + Objects.equals(dataType, that.dataType) && + Objects.equals(datatypeWithEnum, that.datatypeWithEnum) && + Objects.equals(dataFormat, that.dataFormat) && + Objects.equals(collectionFormat, that.collectionFormat) && + Objects.equals(description, that.description) && + Objects.equals(unescapedDescription, that.unescapedDescription) && + Objects.equals(baseType, that.baseType) && + Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(enumName, that.enumName) && + Objects.equals(style, that.style) && + Objects.equals(example, that.example) && + Objects.equals(jsonSchema, that.jsonSchema) && + Objects.equals(_enum, that._enum) && + Objects.equals(allowableValues, that.allowableValues) && + Objects.equals(items, that.items) && + Objects.equals(mostInnerItems, that.mostInnerItems) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(maximum, that.maximum) && + Objects.equals(minimum, that.minimum) && + Objects.equals(maxLength, that.maxLength) && + Objects.equals(minLength, that.minLength) && + Objects.equals(pattern, that.pattern) && + Objects.equals(maxItems, that.maxItems) && + Objects.equals(minItems, that.minItems) && + Objects.equals(multipleOf, that.multipleOf); + } + + @Override + public int hashCode() { + + return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, hasMore, + isContainer, secondaryParam, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, + paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, + baseType, defaultValue, enumName, style, example, jsonSchema, isString, isNumeric, isInteger, isLong, + isNumber, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, + isEmail, isFreeFormObject, isListContainer, isMapContainer, isFile, isEnum, _enum, allowableValues, + items, mostInnerItems, vendorExtensions, hasValidation, isNullable, required, maximum, + exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, maxItems, minItems, + uniqueItems, multipleOf); + } + public boolean isNullable; /** @@ -174,223 +335,10 @@ public class CodegenParameter { output.isListContainer = this.isListContainer; output.isMapContainer = this.isMapContainer; output.isExplode = this.isExplode; + output.style = this.style; return output; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CodegenParameter that = (CodegenParameter) o; - - return Objects.equals(isEnum, that.isEnum) && - Objects.equals(isFormParam, that.isFormParam) && - Objects.equals(isQueryParam, that.isQueryParam) && - Objects.equals(isPathParam, that.isPathParam) && - Objects.equals(isHeaderParam, that.isHeaderParam) && - Objects.equals(isCookieParam, that.isCookieParam) && - Objects.equals(isBodyParam, that.isBodyParam) && - Objects.equals(hasMore, that.hasMore) && - Objects.equals(isContainer, that.isContainer) && - Objects.equals(secondaryParam, that.secondaryParam) && - Objects.equals(isCollectionFormatMulti, that.isCollectionFormatMulti) && - Objects.equals(isPrimitiveType, that.isPrimitiveType) && - Objects.equals(isModel, that.isModel) && - Objects.equals(baseName, that.baseName) && - Objects.equals(paramName, that.paramName) && - Objects.equals(dataType, that.dataType) && - Objects.equals(datatypeWithEnum, that.datatypeWithEnum) && - Objects.equals(enumName, that.enumName) && - Objects.equals(dataFormat, that.dataFormat) && - Objects.equals(collectionFormat, that.collectionFormat) && - Objects.equals(description, that.description) && - Objects.equals(unescapedDescription, that.unescapedDescription) && - Objects.equals(baseType, that.baseType) && - Objects.equals(defaultValue, that.defaultValue) && - Objects.equals(example, that.example) && - Objects.equals(jsonSchema, that.jsonSchema) && - Objects.equals(isString, that.isString) && - Objects.equals(isNumeric, that.isNumeric) && - Objects.equals(isInteger, that.isInteger) && - Objects.equals(isLong, that.isLong) && - Objects.equals(isNumber, that.isNumber) && - Objects.equals(isFloat, that.isFloat) && - Objects.equals(isDouble, that.isDouble) && - Objects.equals(isByteArray, that.isByteArray) && - Objects.equals(isBinary, that.isBinary) && - Objects.equals(isBoolean, that.isBoolean) && - Objects.equals(isDate, that.isDate) && - Objects.equals(isDateTime, that.isDateTime) && - Objects.equals(isUuid, that.isUuid) && - Objects.equals(isUri, that.isUri) && - Objects.equals(isEmail, that.isEmail) && - Objects.equals(isFreeFormObject, that.isFreeFormObject) && - Objects.equals(isListContainer, that.isListContainer) && - Objects.equals(isMapContainer, that.isMapContainer) && - Objects.equals(isFile, that.isFile) && - Objects.equals(_enum, that._enum) && - Objects.equals(allowableValues, that.allowableValues) && - Objects.equals(items, that.items) && - Objects.equals(mostInnerItems, that.mostInnerItems) && - Objects.equals(vendorExtensions, that.vendorExtensions) && - Objects.equals(hasValidation, that.hasValidation) && - Objects.equals(isNullable, that.isNullable) && - Objects.equals(required, that.required) && - Objects.equals(maximum, that.maximum) && - Objects.equals(exclusiveMaximum, that.exclusiveMaximum) && - Objects.equals(minimum, that.minimum) && - Objects.equals(exclusiveMinimum, that.exclusiveMinimum) && - Objects.equals(maxLength, that.maxLength) && - Objects.equals(minLength, that.minLength) && - Objects.equals(pattern, that.pattern) && - Objects.equals(maxItems, that.maxItems) && - Objects.equals(minItems, that.minItems) && - Objects.equals(uniqueItems, that.uniqueItems) && - Objects.equals(multipleOf, that.multipleOf) && - Objects.equals(isExplode, that.isExplode); - } - - @Override - public int hashCode() { - return Objects.hash( - isFormParam, - isQueryParam, - isPathParam, - isHeaderParam, - isCookieParam, - isBodyParam, - hasMore, - isContainer, - secondaryParam, - isCollectionFormatMulti, - isPrimitiveType, - isModel, - baseName, - paramName, - dataType, - datatypeWithEnum, - enumName, - dataFormat, - collectionFormat, - description, - unescapedDescription, - baseType, - defaultValue, - example, - jsonSchema, - isString, - isNumeric, - isInteger, - isLong, - isFloat, - isNumber, - isDouble, - isByteArray, - isBinary, - isBoolean, - isDate, - isDateTime, - isUuid, - isUri, - isEmail, - isFreeFormObject, - isListContainer, - isMapContainer, - isFile, - isEnum, - _enum, - allowableValues, - items, - mostInnerItems, - vendorExtensions, - hasValidation, - isNullable, - required, - maximum, - exclusiveMaximum, - minimum, - exclusiveMinimum, - maxLength, - minLength, - pattern, - maxItems, - minItems, - uniqueItems, - multipleOf, - isExplode); - } - - @java.lang.Override - public java.lang.String toString() { - return "CodegenParameter{" + - "isFormParam=" + isFormParam + - ", isQueryParam=" + isQueryParam + - ", isPathParam=" + isPathParam + - ", isHeaderParam=" + isHeaderParam + - ", isCookieParam=" + isCookieParam + - ", isBodyParam=" + isBodyParam + - ", hasMore=" + hasMore + - ", isContainer=" + isContainer + - ", secondaryParam=" + secondaryParam + - ", isCollectionFormatMulti=" + isCollectionFormatMulti + - ", isPrimitiveType=" + isPrimitiveType + - ", isModel=" + isModel + - ", baseName='" + baseName + '\'' + - ", paramName='" + paramName + '\'' + - ", dataType='" + dataType + '\'' + - ", datatypeWithEnum='" + datatypeWithEnum + '\'' + - ", dataFormat='" + dataFormat + '\'' + - ", collectionFormat='" + collectionFormat + '\'' + - ", description='" + description + '\'' + - ", unescapedDescription='" + unescapedDescription + '\'' + - ", baseType='" + baseType + '\'' + - ", defaultValue='" + defaultValue + '\'' + - ", enumName='" + enumName + '\'' + - ", example='" + example + '\'' + - ", jsonSchema='" + jsonSchema + '\'' + - ", isString=" + isString + - ", isNumeric=" + isNumeric + - ", isInteger=" + isInteger + - ", isLong=" + isLong + - ", isNumber=" + isNumber + - ", isFloat=" + isFloat + - ", isDouble=" + isDouble + - ", isByteArray=" + isByteArray + - ", isBinary=" + isBinary + - ", isBoolean=" + isBoolean + - ", isDate=" + isDate + - ", isDateTime=" + isDateTime + - ", isUuid=" + isUuid + - ", isUri=" + isUri + - ", isEmail=" + isEmail + - ", isFreeFormObject=" + isFreeFormObject + - ", isListContainer=" + isListContainer + - ", isMapContainer=" + isMapContainer + - ", isFile=" + isFile + - ", isEnum=" + isEnum + - ", _enum=" + _enum + - ", allowableValues=" + allowableValues + - ", items=" + items + - ", mostInnerItems=" + mostInnerItems + - ", vendorExtensions=" + vendorExtensions + - ", hasValidation=" + hasValidation + - ", isNullable=" + isNullable + - ", required=" + required + - ", maximum='" + maximum + '\'' + - ", exclusiveMaximum=" + exclusiveMaximum + - ", minimum='" + minimum + '\'' + - ", exclusiveMinimum=" + exclusiveMinimum + - ", maxLength=" + maxLength + - ", minLength=" + minLength + - ", pattern='" + pattern + '\'' + - ", maxItems=" + maxItems + - ", minItems=" + minItems + - ", uniqueItems=" + uniqueItems + - ", multipleOf=" + multipleOf + - ", isExplode=" + isExplode + - '}'; - } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java index 137e2596925..16edb14adf8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java @@ -62,6 +62,7 @@ public class CodegenProperty implements Cloneable { public boolean isWriteOnly; public boolean isNullable; public boolean isSelfReference; + public boolean isCircularReference; public List _enum; public Map allowableValues; public CodegenProperty items; @@ -410,170 +411,6 @@ public class CodegenProperty implements Cloneable { this.xmlNamespace = xmlNamespace; } - @Override - public int hashCode() { - return Objects.hash( - _enum, - allowableValues, - openApiType, - baseName, - baseType, - complexType, - containerType, - dataType, - datatypeWithEnum, - dataFormat, - defaultValue, - defaultValueWithParam, - description, - title, - example, - exclusiveMaximum, - exclusiveMinimum, - getter, - hasMore, - hasMoreNonReadOnly, - isContainer, - isEnum, - isPrimitiveType, - isModel, - isReadOnly, - isWriteOnly, - isNullable, - isSelfReference, - items, - mostInnerItems, - jsonSchema, - max, - maxLength, - maximum, - min, - minLength, - minimum, - name, - pattern, - required, - secondaryParam, - setter, - unescapedDescription, - vendorExtensions, - hasValidation, - isString, - isNumeric, - isInteger, - isLong, - isNumber, - isFloat, - isDouble, - isByteArray, - isBinary, - isFile, - isBoolean, - isDate, - isDateTime, - isUuid, - isUri, - isEmail, - isFreeFormObject, - isMapContainer, - isListContainer, - isInherited, - discriminatorValue, - nameInCamelCase, - nameInSnakeCase, - enumName, - maxItems, - minItems, - isXmlAttribute, - xmlPrefix, - xmlName, - xmlNamespace, - isXmlWrapped); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - - final CodegenProperty other = (CodegenProperty) obj; - - return Objects.equals(baseName, other.baseName) && - Objects.equals(openApiType, other.openApiType) && - Objects.equals(complexType, other.complexType) && - Objects.equals(getter, other.getter) && - Objects.equals(setter, other.setter) && - Objects.equals(description, other.description) && - Objects.equals(title, other.title) && - Objects.equals(dataType, other.dataType) && - Objects.equals(datatypeWithEnum, other.datatypeWithEnum) && - Objects.equals(dataFormat, other.dataFormat) && - Objects.equals(name, other.name) && - Objects.equals(min, other.min) && - Objects.equals(max, other.max) && - Objects.equals(defaultValue, other.defaultValue) && - Objects.equals(baseType, other.baseType) && - Objects.equals(containerType, other.containerType) && - Objects.equals(maxLength, other.maxLength) && - Objects.equals(minLength, other.minLength) && - Objects.equals(pattern, other.pattern) && - Objects.equals(example, other.example) && - Objects.equals(jsonSchema, other.jsonSchema) && - Objects.equals(minimum, other.minimum) && - Objects.equals(maximum, other.maximum) && - Objects.equals(exclusiveMinimum, other.exclusiveMinimum) && - Objects.equals(exclusiveMaximum, other.exclusiveMaximum) && - Objects.equals(required, other.required) && - Objects.equals(secondaryParam, other.secondaryParam) && - Objects.equals(isPrimitiveType, other.isPrimitiveType) && - Objects.equals(isModel, other.isModel) && - Objects.equals(isContainer, other.isContainer) && - Objects.equals(isEnum, other.isEnum) && - Objects.equals(isReadOnly, other.isReadOnly) && - Objects.equals(isWriteOnly, other.isWriteOnly) && - Objects.equals(isNullable, other.isNullable) && - Objects.equals(isSelfReference, other.isSelfReference) && - Objects.equals(_enum, other._enum) && - Objects.equals(allowableValues, other.allowableValues) && - Objects.equals(vendorExtensions, other.vendorExtensions) && - Objects.equals(hasValidation, other.hasValidation) && - Objects.equals(isString, other.isString) && - Objects.equals(isNumeric, other.isNumeric) && - Objects.equals(isInteger, other.isInteger) && - Objects.equals(isLong, other.isLong) && - Objects.equals(isNumber, other.isNumber) && - Objects.equals(isFloat, other.isFloat) && - Objects.equals(isDouble, other.isDouble) && - Objects.equals(isByteArray, other.isByteArray) && - Objects.equals(isBoolean, other.isBoolean) && - Objects.equals(isDate, other.isDate) && - Objects.equals(isDateTime, other.isDateTime) && - Objects.equals(isUuid, other.isUuid) && - Objects.equals(isUri, other.isUri) && - Objects.equals(isEmail, other.isEmail) && - Objects.equals(isFreeFormObject, other.isFreeFormObject) && - Objects.equals(isBinary, other.isBinary) && - Objects.equals(isFile, other.isFile) && - Objects.equals(isListContainer, other.isListContainer) && - Objects.equals(isMapContainer, other.isMapContainer) && - Objects.equals(isInherited, other.isInherited) && - Objects.equals(discriminatorValue, other.discriminatorValue) && - Objects.equals(nameInCamelCase, other.nameInCamelCase) && - Objects.equals(nameInSnakeCase, other.nameInSnakeCase) && - Objects.equals(enumName, other.enumName) && - Objects.equals(maxItems, other.maxItems) && - Objects.equals(minItems, other.minItems) && - Objects.equals(isXmlAttribute, other.isXmlAttribute) && - Objects.equals(xmlPrefix, other.xmlPrefix) && - Objects.equals(xmlName, other.xmlName) && - Objects.equals(xmlNamespace, other.xmlNamespace) && - Objects.equals(isXmlWrapped, other.isXmlWrapped); - } - @Override public CodegenProperty clone() { try { @@ -600,86 +437,188 @@ public class CodegenProperty implements Cloneable { } } - @java.lang.Override - public java.lang.String toString() { - return "CodegenProperty{" + - "baseName='" + baseName + '\'' + - ", openApiType='" + openApiType + '\'' + - ", complexType='" + complexType + '\'' + - ", getter='" + getter + '\'' + - ", setter='" + setter + '\'' + - ", description='" + description + '\'' + - ", datatype='" + dataType + '\'' + - ", datatypeWithEnum='" + datatypeWithEnum + '\'' + - ", dataFormat='" + dataFormat + '\'' + - ", name='" + name + '\'' + - ", min='" + min + '\'' + - ", max='" + max + '\'' + - ", defaultValue='" + defaultValue + '\'' + - ", defaultValueWithParam='" + defaultValueWithParam + '\'' + - ", baseType='" + baseType + '\'' + - ", containerType='" + containerType + '\'' + - ", title='" + title + '\'' + - ", unescapedDescription='" + unescapedDescription + '\'' + - ", maxLength=" + maxLength + - ", minLength=" + minLength + - ", pattern='" + pattern + '\'' + - ", example='" + example + '\'' + - ", jsonSchema='" + jsonSchema + '\'' + - ", minimum='" + minimum + '\'' + - ", maximum='" + maximum + '\'' + - ", exclusiveMinimum=" + exclusiveMinimum + - ", exclusiveMaximum=" + exclusiveMaximum + - ", hasMore=" + hasMore + - ", required=" + required + - ", secondaryParam=" + secondaryParam + - ", hasMoreNonReadOnly=" + hasMoreNonReadOnly + - ", isPrimitiveType=" + isPrimitiveType + - ", isModel=" + isModel + - ", isContainer=" + isContainer + - ", isString=" + isString + - ", isNumeric=" + isNumeric + - ", isInteger=" + isInteger + - ", isLong=" + isLong + - ", isNumber=" + isNumber + - ", isFloat=" + isFloat + - ", isDouble=" + isDouble + - ", isByteArray=" + isByteArray + - ", isBinary=" + isBinary + - ", isFile=" + isFile + - ", isBoolean=" + isBoolean + - ", isDate=" + isDate + - ", isDateTime=" + isDateTime + - ", isUuid=" + isUuid + - ", isUri=" + isUri + - ", isEmail=" + isEmail + - ", isFreeFormObject=" + isFreeFormObject + - ", isListContainer=" + isListContainer + - ", isMapContainer=" + isMapContainer + - ", isEnum=" + isEnum + - ", isReadOnly=" + isReadOnly + - ", isWriteOnly=" + isWriteOnly + - ", isNullable=" + isNullable + - ", isSelfReference=" + isSelfReference + - ", _enum=" + _enum + - ", allowableValues=" + allowableValues + - ", items=" + items + - ", mostInnerItems=" + mostInnerItems + - ", vendorExtensions=" + vendorExtensions + - ", hasValidation=" + hasValidation + - ", isInherited=" + isInherited + - ", discriminatorValue='" + discriminatorValue + '\'' + - ", nameInCamelCase='" + nameInCamelCase + '\'' + - ", enumName='" + enumName + '\'' + - ", maxItems=" + maxItems + - ", minItems=" + minItems + - ", isXmlAttribute=" + isXmlAttribute + - ", xmlPrefix='" + xmlPrefix + '\'' + - ", xmlName='" + xmlName + '\'' + - ", xmlNamespace='" + xmlNamespace + '\'' + - ", isXmlWrapped=" + isXmlWrapped + - '}'; + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenProperty{"); + sb.append("openApiType='").append(openApiType).append('\''); + sb.append(", baseName='").append(baseName).append('\''); + sb.append(", complexType='").append(complexType).append('\''); + sb.append(", getter='").append(getter).append('\''); + sb.append(", setter='").append(setter).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", dataType='").append(dataType).append('\''); + sb.append(", datatypeWithEnum='").append(datatypeWithEnum).append('\''); + sb.append(", dataFormat='").append(dataFormat).append('\''); + sb.append(", name='").append(name).append('\''); + sb.append(", min='").append(min).append('\''); + sb.append(", max='").append(max).append('\''); + sb.append(", defaultValue='").append(defaultValue).append('\''); + sb.append(", defaultValueWithParam='").append(defaultValueWithParam).append('\''); + sb.append(", baseType='").append(baseType).append('\''); + sb.append(", containerType='").append(containerType).append('\''); + sb.append(", title='").append(title).append('\''); + sb.append(", unescapedDescription='").append(unescapedDescription).append('\''); + sb.append(", maxLength=").append(maxLength); + sb.append(", minLength=").append(minLength); + sb.append(", pattern='").append(pattern).append('\''); + sb.append(", example='").append(example).append('\''); + sb.append(", jsonSchema='").append(jsonSchema).append('\''); + sb.append(", minimum='").append(minimum).append('\''); + sb.append(", maximum='").append(maximum).append('\''); + sb.append(", exclusiveMinimum=").append(exclusiveMinimum); + sb.append(", exclusiveMaximum=").append(exclusiveMaximum); + sb.append(", hasMore=").append(hasMore); + sb.append(", required=").append(required); + sb.append(", secondaryParam=").append(secondaryParam); + sb.append(", hasMoreNonReadOnly=").append(hasMoreNonReadOnly); + sb.append(", isPrimitiveType=").append(isPrimitiveType); + sb.append(", isModel=").append(isModel); + sb.append(", isContainer=").append(isContainer); + sb.append(", isString=").append(isString); + sb.append(", isNumeric=").append(isNumeric); + sb.append(", isInteger=").append(isInteger); + sb.append(", isLong=").append(isLong); + sb.append(", isNumber=").append(isNumber); + sb.append(", isFloat=").append(isFloat); + sb.append(", isDouble=").append(isDouble); + sb.append(", isByteArray=").append(isByteArray); + sb.append(", isBinary=").append(isBinary); + sb.append(", isFile=").append(isFile); + sb.append(", isBoolean=").append(isBoolean); + sb.append(", isDate=").append(isDate); + sb.append(", isDateTime=").append(isDateTime); + sb.append(", isUuid=").append(isUuid); + sb.append(", isUri=").append(isUri); + sb.append(", isEmail=").append(isEmail); + sb.append(", isFreeFormObject=").append(isFreeFormObject); + sb.append(", isListContainer=").append(isListContainer); + sb.append(", isMapContainer=").append(isMapContainer); + sb.append(", isEnum=").append(isEnum); + sb.append(", isReadOnly=").append(isReadOnly); + sb.append(", isWriteOnly=").append(isWriteOnly); + sb.append(", isNullable=").append(isNullable); + sb.append(", isSelfReference=").append(isSelfReference); + sb.append(", isCircularReference=").append(isCircularReference); + sb.append(", _enum=").append(_enum); + sb.append(", allowableValues=").append(allowableValues); + sb.append(", items=").append(items); + sb.append(", mostInnerItems=").append(mostInnerItems); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", hasValidation=").append(hasValidation); + sb.append(", isInherited=").append(isInherited); + sb.append(", discriminatorValue='").append(discriminatorValue).append('\''); + sb.append(", nameInCamelCase='").append(nameInCamelCase).append('\''); + sb.append(", nameInSnakeCase='").append(nameInSnakeCase).append('\''); + sb.append(", enumName='").append(enumName).append('\''); + sb.append(", maxItems=").append(maxItems); + sb.append(", minItems=").append(minItems); + sb.append(", isXmlAttribute=").append(isXmlAttribute); + sb.append(", xmlPrefix='").append(xmlPrefix).append('\''); + sb.append(", xmlName='").append(xmlName).append('\''); + sb.append(", xmlNamespace='").append(xmlNamespace).append('\''); + sb.append(", isXmlWrapped=").append(isXmlWrapped); + sb.append('}'); + return sb.toString(); } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenProperty that = (CodegenProperty) o; + return exclusiveMinimum == that.exclusiveMinimum && + exclusiveMaximum == that.exclusiveMaximum && + hasMore == that.hasMore && + required == that.required && + secondaryParam == that.secondaryParam && + hasMoreNonReadOnly == that.hasMoreNonReadOnly && + isPrimitiveType == that.isPrimitiveType && + isModel == that.isModel && + isContainer == that.isContainer && + isString == that.isString && + isNumeric == that.isNumeric && + isInteger == that.isInteger && + isLong == that.isLong && + isNumber == that.isNumber && + isFloat == that.isFloat && + isDouble == that.isDouble && + isByteArray == that.isByteArray && + isBinary == that.isBinary && + isFile == that.isFile && + isBoolean == that.isBoolean && + isDate == that.isDate && + isDateTime == that.isDateTime && + isUuid == that.isUuid && + isUri == that.isUri && + isEmail == that.isEmail && + isFreeFormObject == that.isFreeFormObject && + isListContainer == that.isListContainer && + isMapContainer == that.isMapContainer && + isEnum == that.isEnum && + isReadOnly == that.isReadOnly && + isWriteOnly == that.isWriteOnly && + isNullable == that.isNullable && + isSelfReference == that.isSelfReference && + isCircularReference == that.isCircularReference && + hasValidation == that.hasValidation && + isInherited == that.isInherited && + isXmlAttribute == that.isXmlAttribute && + isXmlWrapped == that.isXmlWrapped && + Objects.equals(openApiType, that.openApiType) && + Objects.equals(baseName, that.baseName) && + Objects.equals(complexType, that.complexType) && + Objects.equals(getter, that.getter) && + Objects.equals(setter, that.setter) && + Objects.equals(description, that.description) && + Objects.equals(dataType, that.dataType) && + Objects.equals(datatypeWithEnum, that.datatypeWithEnum) && + Objects.equals(dataFormat, that.dataFormat) && + Objects.equals(name, that.name) && + Objects.equals(min, that.min) && + Objects.equals(max, that.max) && + Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(defaultValueWithParam, that.defaultValueWithParam) && + Objects.equals(baseType, that.baseType) && + Objects.equals(containerType, that.containerType) && + Objects.equals(title, that.title) && + Objects.equals(unescapedDescription, that.unescapedDescription) && + Objects.equals(maxLength, that.maxLength) && + Objects.equals(minLength, that.minLength) && + Objects.equals(pattern, that.pattern) && + Objects.equals(example, that.example) && + Objects.equals(jsonSchema, that.jsonSchema) && + Objects.equals(minimum, that.minimum) && + Objects.equals(maximum, that.maximum) && + Objects.equals(_enum, that._enum) && + Objects.equals(allowableValues, that.allowableValues) && + Objects.equals(items, that.items) && + Objects.equals(mostInnerItems, that.mostInnerItems) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(discriminatorValue, that.discriminatorValue) && + Objects.equals(nameInCamelCase, that.nameInCamelCase) && + Objects.equals(nameInSnakeCase, that.nameInSnakeCase) && + Objects.equals(enumName, that.enumName) && + Objects.equals(maxItems, that.maxItems) && + Objects.equals(minItems, that.minItems) && + Objects.equals(xmlPrefix, that.xmlPrefix) && + Objects.equals(xmlName, that.xmlName) && + Objects.equals(xmlNamespace, that.xmlNamespace); + } + @Override + public int hashCode() { + + return Objects.hash(openApiType, baseName, complexType, getter, setter, description, dataType, + datatypeWithEnum, dataFormat, name, min, max, defaultValue, defaultValueWithParam, baseType, + containerType, title, unescapedDescription, maxLength, minLength, pattern, example, jsonSchema, + minimum, maximum, exclusiveMinimum, exclusiveMaximum, hasMore, required, secondaryParam, + hasMoreNonReadOnly, isPrimitiveType, isModel, isContainer, isString, isNumeric, isInteger, + isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, + isUuid, isUri, isEmail, isFreeFormObject, isListContainer, isMapContainer, isEnum, isReadOnly, + isWriteOnly, isNullable, isSelfReference, isCircularReference, _enum, allowableValues, items, + mostInnerItems, vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase, + nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName, xmlNamespace, + isXmlWrapped); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index e4241ee00eb..511c0fc7b60 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -24,7 +24,7 @@ public class CodegenResponse { public String code, message; public boolean hasMore; public List> examples; - public String dataType, baseType, containerType; + public String dataType, baseType, containerType, pattern; public boolean hasHeaders; public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBoolean, isDate, isDateTime, isUuid, isEmail, isModel, isFreeFormObject; @@ -43,50 +43,10 @@ public class CodegenResponse { return "0".equals(code) || "default".equals(code); } - @Override - public String toString() { - return "CodegenResponse{" + - "headers=" + headers + - ", code='" + code + '\'' + - ", message='" + message + '\'' + - ", hasMore=" + hasMore + - ", examples=" + examples + - ", dataType='" + dataType + '\'' + - ", baseType='" + baseType + '\'' + - ", containerType='" + containerType + '\'' + - ", hasHeaders=" + hasHeaders + - ", isString=" + isString + - ", isNumeric=" + isNumeric + - ", isInteger=" + isInteger + - ", isLong=" + isLong + - ", isNumber=" + isNumber + - ", isFloat=" + isFloat + - ", isDouble=" + isDouble + - ", isByteArray=" + isByteArray + - ", isBoolean=" + isBoolean + - ", isDate=" + isDate + - ", isDateTime=" + isDateTime + - ", isUuid=" + isUuid + - ", isEmail=" + isEmail + - ", isFreeFormObject=" + isFreeFormObject + - ", isModel=" + isModel + - ", isDefault=" + isDefault + - ", simpleType=" + simpleType + - ", primitiveType=" + primitiveType + - ", isMapContainer=" + isMapContainer + - ", isListContainer=" + isListContainer + - ", isBinary=" + isBinary + - ", isFile=" + isFile + - ", schema=" + schema + - ", jsonSchema='" + jsonSchema + '\'' + - ", vendorExtensions=" + vendorExtensions + - '}'; - } - @Override public boolean equals(Object o) { if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (!(o instanceof CodegenResponse)) return false; CodegenResponse that = (CodegenResponse) o; return hasMore == that.hasMore && hasHeaders == that.hasHeaders && @@ -103,8 +63,8 @@ public class CodegenResponse { isDateTime == that.isDateTime && isUuid == that.isUuid && isEmail == that.isEmail && - isFreeFormObject == that.isFreeFormObject && isModel == that.isModel && + isFreeFormObject == that.isFreeFormObject && isDefault == that.isDefault && simpleType == that.simpleType && primitiveType == that.primitiveType && @@ -119,6 +79,7 @@ public class CodegenResponse { Objects.equals(dataType, that.dataType) && Objects.equals(baseType, that.baseType) && Objects.equals(containerType, that.containerType) && + Objects.equals(pattern, that.pattern) && Objects.equals(schema, that.schema) && Objects.equals(jsonSchema, that.jsonSchema) && Objects.equals(vendorExtensions, that.vendorExtensions); @@ -126,9 +87,51 @@ public class CodegenResponse { @Override public int hashCode() { - return Objects.hash(headers, code, message, hasMore, examples, dataType, baseType, containerType, hasHeaders, - isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBoolean, isDate, - isDateTime, isUuid, isEmail, isFreeFormObject, isModel, isDefault, simpleType, primitiveType, isMapContainer, - isListContainer, isBinary, isFile, schema, jsonSchema, vendorExtensions); + return Objects.hash(headers, code, message, hasMore, examples, dataType, baseType, containerType, pattern, + hasHeaders, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, + isBoolean, isDate, isDateTime, isUuid, isEmail, isModel, isFreeFormObject, isDefault, simpleType, + primitiveType, isMapContainer, isListContainer, isBinary, isFile, schema, jsonSchema, vendorExtensions); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenResponse{"); + sb.append("headers=").append(headers); + sb.append(", code='").append(code).append('\''); + sb.append(", message='").append(message).append('\''); + sb.append(", hasMore=").append(hasMore); + sb.append(", examples=").append(examples); + sb.append(", dataType='").append(dataType).append('\''); + sb.append(", pattern='").append(pattern).append('\''); + sb.append(", baseType='").append(baseType).append('\''); + sb.append(", containerType='").append(containerType).append('\''); + sb.append(", hasHeaders=").append(hasHeaders); + sb.append(", isString=").append(isString); + sb.append(", isNumeric=").append(isNumeric); + sb.append(", isInteger=").append(isInteger); + sb.append(", isLong=").append(isLong); + sb.append(", isNumber=").append(isNumber); + sb.append(", isFloat=").append(isFloat); + sb.append(", isDouble=").append(isDouble); + sb.append(", isByteArray=").append(isByteArray); + sb.append(", isBoolean=").append(isBoolean); + sb.append(", isDate=").append(isDate); + sb.append(", isDateTime=").append(isDateTime); + sb.append(", isUuid=").append(isUuid); + sb.append(", isEmail=").append(isEmail); + sb.append(", isModel=").append(isModel); + sb.append(", isFreeFormObject=").append(isFreeFormObject); + sb.append(", isDefault=").append(isDefault); + sb.append(", simpleType=").append(simpleType); + sb.append(", primitiveType=").append(primitiveType); + sb.append(", isMapContainer=").append(isMapContainer); + sb.append(", isListContainer=").append(isListContainer); + sb.append(", isBinary=").append(isBinary); + sb.append(", isFile=").append(isFile); + sb.append(", schema=").append(schema); + sb.append(", jsonSchema='").append(jsonSchema).append('\''); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append('}'); + return sb.toString(); } } 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 ea51d6ff559..e7abb8c90d1 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 @@ -41,67 +41,6 @@ public class CodegenSecurity { public List> scopes; public Boolean isCode, isPassword, isApplication, isImplicit; - @Override - public String toString() { - return String.format(Locale.ROOT, "%s(%s)", name, type); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CodegenSecurity that = (CodegenSecurity) o; - - return Objects.equals(name, that.name) && - Objects.equals(type, that.type) && - Objects.equals(hasMore, that.hasMore) && - Objects.equals(isBasic, that.isBasic) && - Objects.equals(isBasicBasic, that.isBasicBasic) && - Objects.equals(isBasicBearer, that.isBasicBearer) && - Objects.equals(bearerFormat, that.bearerFormat) && - Objects.equals(isOAuth, that.isOAuth) && - Objects.equals(isApiKey, that.isApiKey) && - Objects.equals(vendorExtensions, that.vendorExtensions) && - Objects.equals(keyParamName, that.keyParamName) && - Objects.equals(isKeyInQuery, that.isKeyInQuery) && - Objects.equals(isKeyInHeader, that.isKeyInHeader) && - Objects.equals(flow, that.flow) && - Objects.equals(authorizationUrl, that.authorizationUrl) && - Objects.equals(tokenUrl, that.tokenUrl) && - Objects.equals(isCode, that.isCode) && - Objects.equals(isPassword, that.isPassword) && - Objects.equals(isApplication, that.isApplication) && - Objects.equals(isImplicit, that.isImplicit) && - Objects.equals(scopes, that.scopes); - } - - @Override - public int hashCode() { - return Objects.hash( - name, - type, - hasMore, - isBasic, - isBasicBasic, - isBasicBearer, - bearerFormat, - isOAuth, - isApiKey, - vendorExtensions, - keyParamName, - isKeyInQuery, - isKeyInHeader, - flow, - authorizationUrl, - tokenUrl, - isCode, - isPassword, - isApplication, - isImplicit, - scopes); - } - // Return a copy of the security object, filtering out any scopes from the passed-in list. public CodegenSecurity filterByScopeNames(List filterScopes) { CodegenSecurity filteredSecurity = new CodegenSecurity(); @@ -144,4 +83,72 @@ public class CodegenSecurity { return filteredSecurity; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenSecurity that = (CodegenSecurity) o; + return Objects.equals(name, that.name) && + Objects.equals(type, that.type) && + Objects.equals(scheme, that.scheme) && + Objects.equals(hasMore, that.hasMore) && + Objects.equals(isBasic, that.isBasic) && + Objects.equals(isOAuth, that.isOAuth) && + Objects.equals(isApiKey, that.isApiKey) && + Objects.equals(isBasicBasic, that.isBasicBasic) && + Objects.equals(isBasicBearer, that.isBasicBearer) && + Objects.equals(bearerFormat, that.bearerFormat) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(keyParamName, that.keyParamName) && + Objects.equals(isKeyInQuery, that.isKeyInQuery) && + Objects.equals(isKeyInHeader, that.isKeyInHeader) && + Objects.equals(isKeyInCookie, that.isKeyInCookie) && + Objects.equals(flow, that.flow) && + Objects.equals(authorizationUrl, that.authorizationUrl) && + Objects.equals(tokenUrl, that.tokenUrl) && + Objects.equals(scopes, that.scopes) && + Objects.equals(isCode, that.isCode) && + Objects.equals(isPassword, that.isPassword) && + Objects.equals(isApplication, that.isApplication) && + Objects.equals(isImplicit, that.isImplicit); + } + + @Override + public int hashCode() { + + return Objects.hash(name, type, scheme, hasMore, isBasic, isOAuth, isApiKey, isBasicBasic, isBasicBearer, + bearerFormat, vendorExtensions, keyParamName, isKeyInQuery, isKeyInHeader, isKeyInCookie, flow, + authorizationUrl, tokenUrl, scopes, isCode, isPassword, isApplication, isImplicit); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenSecurity{"); + sb.append("name='").append(name).append('\''); + sb.append(", type='").append(type).append('\''); + sb.append(", scheme='").append(scheme).append('\''); + sb.append(", hasMore=").append(hasMore); + sb.append(", isBasic=").append(isBasic); + sb.append(", isOAuth=").append(isOAuth); + sb.append(", isApiKey=").append(isApiKey); + sb.append(", isBasicBasic=").append(isBasicBasic); + sb.append(", isBasicBearer=").append(isBasicBearer); + sb.append(", bearerFormat='").append(bearerFormat).append('\''); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", keyParamName='").append(keyParamName).append('\''); + sb.append(", isKeyInQuery=").append(isKeyInQuery); + sb.append(", isKeyInHeader=").append(isKeyInHeader); + sb.append(", isKeyInCookie=").append(isKeyInCookie); + sb.append(", flow='").append(flow).append('\''); + sb.append(", authorizationUrl='").append(authorizationUrl).append('\''); + sb.append(", tokenUrl='").append(tokenUrl).append('\''); + sb.append(", scopes=").append(scopes); + sb.append(", isCode=").append(isCode); + sb.append(", isPassword=").append(isPassword); + sb.append(", isApplication=").append(isApplication); + sb.append(", isImplicit=").append(isImplicit); + sb.append('}'); + return sb.toString(); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java index 0708d4407fc..f1116546028 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java @@ -1,9 +1,36 @@ package org.openapitools.codegen; import java.util.List; +import java.util.Objects; public class CodegenServer { public String url; public String description; public List variables; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenServer that = (CodegenServer) o; + return Objects.equals(url, that.url) && + Objects.equals(description, that.description) && + Objects.equals(variables, that.variables); + } + + @Override + public int hashCode() { + + return Objects.hash(url, description, variables); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenServer{"); + sb.append("url='").append(url).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", variables=").append(variables); + sb.append('}'); + return sb.toString(); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java index 15ae1ca15b1..0cd643e2723 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java @@ -1,6 +1,7 @@ package org.openapitools.codegen; import java.util.List; +import java.util.Objects; public class CodegenServerVariable { public String name; @@ -8,4 +9,34 @@ public class CodegenServerVariable { public String description; public List enumValues; public String value; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenServerVariable that = (CodegenServerVariable) o; + return Objects.equals(name, that.name) && + Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(description, that.description) && + Objects.equals(enumValues, that.enumValues) && + Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + + return Objects.hash(name, defaultValue, description, enumValues, value); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenServerVariable{"); + sb.append("name='").append(name).append('\''); + sb.append(", defaultValue='").append(defaultValue).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", enumValues=").append(enumValues); + sb.append(", value='").append(value).append('\''); + sb.append('}'); + return sb.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 c2347eabfdb..f35967ea2e9 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 @@ -328,10 +328,61 @@ public class DefaultCodegen implements CodegenConfig { } } } + setCircularReferences(allModels); return objs; } + public void setCircularReferences(Map models) { + final Map> dependencyMap = models.entrySet().stream() + .collect(Collectors.toMap(Entry::getKey, entry -> getModelDependencies(entry.getValue()))); + + models.keySet().forEach(name -> setCircularReferencesOnProperties(name, dependencyMap)); + } + + private List getModelDependencies(CodegenModel model) { + return model.getAllVars().stream() + .map(prop -> { + if (prop.isContainer) { + return prop.items.dataType == null ? null : prop; + } + return prop.dataType == null ? null : prop; + }) + .filter(prop -> prop != null) + .collect(Collectors.toList()); + } + + private void setCircularReferencesOnProperties(final String root, + final Map> dependencyMap) { + dependencyMap.getOrDefault(root, new ArrayList<>()).stream() + .forEach(prop -> { + final List unvisited = + Collections.singletonList(prop.isContainer ? prop.items.dataType : prop.dataType); + prop.isCircularReference = isCircularReference(root, + new HashSet<>(), + new ArrayList<>(unvisited), + dependencyMap); + }); + } + + private boolean isCircularReference(final String root, + final Set visited, + final List unvisited, + final Map> dependencyMap) { + for (int i = 0; i < unvisited.size(); i++) { + final String next = unvisited.get(i); + if (!visited.contains(next)) { + if (next.equals(root)) { + return true; + } + dependencyMap.getOrDefault(next, new ArrayList<>()) + .forEach(prop -> unvisited.add(prop.isContainer ? prop.items.dataType : prop.dataType)); + visited.add(next); + } + } + return false; + } + // override with any special post-processing @SuppressWarnings("static-method") public Map postProcessModels(Map objs) { @@ -1788,11 +1839,19 @@ public class DefaultCodegen implements CodegenConfig { Map allProperties = new LinkedHashMap(); List allRequired = new ArrayList(); + // if schema has properties outside of allOf/oneOf/anyOf also add them to m + if (composed.getProperties() != null && !composed.getProperties().isEmpty()) { + if (composed.getOneOf() != null && !composed.getOneOf().isEmpty()) { + LOGGER.warn("'oneOf' is intended to include only the additional optional OAS extension discriminator object. " + + "For more details, see https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.9.2.1.3 and the OAS section on 'Composition and Inheritance'."); + } + addVars(m, unaliasPropertySchema(composed.getProperties()), composed.getRequired(), null, null); + } + // parent model final String parentName = ModelUtils.getParentName(composed, allDefinitions); final List allParents = ModelUtils.getAllParentsName(composed, allDefinitions); final Schema parent = StringUtils.isBlank(parentName) || allDefinitions == null ? null : allDefinitions.get(parentName); - final boolean hasParent = StringUtils.isNotBlank(parentName); // TODO revise the logic below to set dicriminator, xml attributes if (supportsInheritance || supportsMixins) { @@ -2879,6 +2938,10 @@ public class DefaultCodegen implements CodegenConfig { responseSchema = ModelUtils.getSchemaFromResponse(response); } r.schema = responseSchema; + if (responseSchema != null && responseSchema.getPattern() != null) { + r.pattern = toRegularExpression(responseSchema.getPattern()); + } + r.message = escapeText(response.getDescription()); // TODO need to revise and test examples in responses // ApiResponse does not support examples at the moment 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 7f56122e52c..2d263ed3867 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 @@ -1295,6 +1295,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { // We have to create a new auth method instance because the original object must // not be modified. CodegenSecurity opSecurity = security.filterByScopeNames(opScopes); + opSecurity.hasMore = security.hasMore; result.add(opSecurity); filtered = true; break; 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 55a5f229e0f..14d5f51808c 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 @@ -376,7 +376,6 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege // 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 4d99af1c058..7bc938a6811 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 @@ -54,6 +54,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public static final String SUPPORT_JAVA6 = "supportJava6"; public static final String DISABLE_HTML_ESCAPING = "disableHtmlEscaping"; public static final String BOOLEAN_GETTER_PREFIX = "booleanGetterPrefix"; + public static final String ADDITIONAL_MODEL_TYPE_ANNOTATIONS = "additionalModelTypeAnnotations"; protected String dateLibrary = "threetenbp"; protected boolean supportAsync = false; @@ -91,6 +92,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code protected String parentArtifactId = ""; protected String parentVersion = ""; protected boolean parentOverridden = false; + protected List additionalModelTypeAnnotations = new LinkedList<>(); public AbstractJavaCodegen() { super(); @@ -184,6 +186,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code cliOptions.add(CliOption.newBoolean(DISABLE_HTML_ESCAPING, "Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)", disableHtmlEscaping)); cliOptions.add(CliOption.newString(BOOLEAN_GETTER_PREFIX, "Set booleanGetterPrefix").defaultValue(this.getBooleanGetterPrefix())); + cliOptions.add(CliOption.newString(ADDITIONAL_MODEL_TYPE_ANNOTATIONS, "Additional annotations for model type(class level annotations)")); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); @@ -221,6 +224,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code } additionalProperties.put(BOOLEAN_GETTER_PREFIX, booleanGetterPrefix); + if (additionalProperties.containsKey(ADDITIONAL_MODEL_TYPE_ANNOTATIONS)) { + String additionalAnnotationsList = additionalProperties.get(ADDITIONAL_MODEL_TYPE_ANNOTATIONS).toString(); + + this.setAdditionalModelTypeAnnotations(Arrays.asList(additionalAnnotationsList.split(";"))); + } + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); } else if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { @@ -488,6 +497,20 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code } } + @Override + public Map postProcessAllModels(Map objs) { + objs = super.updateAllModels(objs); + + if (!additionalModelTypeAnnotations.isEmpty()) { + for (String modelName : objs.keySet()) { + Map models = (Map) objs.get(modelName); + models.put(ADDITIONAL_MODEL_TYPE_ANNOTATIONS, additionalModelTypeAnnotations); + } + } + + return objs; + } + private void sanitizeConfig() { // Sanitize any config options here. We also have to update the additionalProperties because // the whole additionalProperties object is injected into the main object passed to the mustache layer @@ -1547,6 +1570,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code this.parentOverridden = parentOverridden; } + public void setAdditionalModelTypeAnnotations(final List additionalModelTypeAnnotations) { + this.additionalModelTypeAnnotations = additionalModelTypeAnnotations; + } + @Override protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) { super.addAdditionPropertiesToCodeGenModel(codegenModel, schema); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index 733cdd47b47..606e0564c44 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -43,6 +43,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson} + public static final String MODEL_MUTABLE = "modelMutable"; + public static final String MODEL_MUTABLE_DESC = "Create mutable models"; + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class); protected String artifactId; @@ -225,6 +228,8 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co cliOptions.add(new CliOption(CodegenConstants.PARCELIZE_MODELS, CodegenConstants.PARCELIZE_MODELS_DESC)); cliOptions.add(new CliOption(CodegenConstants.SERIALIZABLE_MODEL, CodegenConstants.SERIALIZABLE_MODEL_DESC)); + + cliOptions.add(CliOption.newBoolean(MODEL_MUTABLE, MODEL_MUTABLE_DESC, false)); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java index d192dd80010..15bfcb01036 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java @@ -347,6 +347,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { }); } } + setCircularReferences(allModels); for (Map.Entry entry : objs.entrySet()) { Map inner = (Map) entry.getValue(); List> models = (List>) inner.get("models"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java index db2f36d1f32..e37f80bf409 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java @@ -144,10 +144,19 @@ public class GoServerCodegen extends AbstractGoCodegen { if (additionalProperties.containsKey("serverPort") && additionalProperties.get("serverPort") instanceof Integer) { this.setServerPort((int) additionalProperties.get("serverPort")); + } else if (additionalProperties.containsKey("serverPort") && additionalProperties.get("serverPort") instanceof String){ + try { + this.setServerPort(Integer.parseInt(additionalProperties.get("serverPort").toString())); + additionalProperties.put("serverPort", serverPort); + } + catch (NumberFormatException e) + { + LOGGER.warn("serverPort is not a valid integer... defaulting to {}", serverPort); + additionalProperties.put("serverPort", serverPort); + } } else { additionalProperties.put("serverPort", serverPort); } - if (additionalProperties.containsKey("featureCORS")) { this.setFeatureCORS(convertPropertyToBooleanAndWriteBack("featureCORS")); } else { @@ -165,6 +174,7 @@ public class GoServerCodegen extends AbstractGoCodegen { supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml")); supportingFiles.add(new SupportingFile("main.mustache", "", "main.go")); supportingFiles.add(new SupportingFile("Dockerfile.mustache", "", "Dockerfile")); + supportingFiles.add(new SupportingFile("go.mod.mustache", "", "go.mod")); supportingFiles.add(new SupportingFile("routers.mustache", sourceFolder, "routers.go")); supportingFiles.add(new SupportingFile("logger.mustache", sourceFolder, "logger.go")); supportingFiles.add(new SupportingFile("api.mustache", sourceFolder, "api.go")); 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 d534f39c3a0..3138fae2a21 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 @@ -29,6 +29,9 @@ import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.media.Schema; + import java.io.File; import java.util.*; import java.util.regex.Pattern; @@ -39,8 +42,7 @@ import static java.util.Collections.sort; import static org.openapitools.codegen.utils.StringUtils.camelize; public class JavaClientCodegen extends AbstractJavaCodegen - implements BeanValidationFeatures, PerformBeanValidationFeatures, - GzipFeatures { + implements BeanValidationFeatures, PerformBeanValidationFeatures, GzipFeatures { static final String MEDIA_TYPE = "mediaType"; @@ -77,6 +79,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String RETROFIT_1 = "retrofit"; public static final String RETROFIT_2 = "retrofit2"; public static final String VERTX = "vertx"; + public static final String MICROPROFILE = "microprofile"; public static final String SERIALIZATION_LIBRARY_GSON = "gson"; public static final String SERIALIZATION_LIBRARY_JACKSON = "jackson"; @@ -145,6 +148,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen supportedLibraries.put(GOOGLE_API_CLIENT, "HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x"); supportedLibraries.put(REST_ASSURED, "HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.9.x. Only for Java8"); supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+"); + supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x"); CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); libraryOption.setEnum(supportedLibraries); @@ -176,11 +180,22 @@ public class JavaClientCodegen extends AbstractJavaCodegen return "Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (1.x, 2.x), OpenFeign (9.x, 10.x) and more."; } + @Override + public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { + super.addOperationToGroup(tag, resourcePath, operation, co, operations); + if (MICROPROFILE.equals(getLibrary())) { + co.subresourceOperation = !co.path.isEmpty(); + } + } + @Override public void processOpts() { if ((WEBCLIENT.equals(getLibrary()) && "threetenbp".equals(dateLibrary)) || NATIVE.equals(getLibrary())) { dateLibrary = "java8"; } + else if (MICROPROFILE.equals(getLibrary())) { + dateLibrary = "legacy"; + } super.processOpts(); @@ -266,12 +281,12 @@ public class JavaClientCodegen extends AbstractJavaCodegen writeOptional(outputFolder, new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml")); supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java")); - if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()))) { + if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java")); } // google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer) - if (!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()))) { + if (!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java")); supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.mustache", authFolder, "HttpBearerAuth.java")); supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java")); @@ -303,13 +318,13 @@ public class JavaClientCodegen extends AbstractJavaCodegen apiDocTemplateFiles.remove("api_doc.mustache"); } - if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()))) { + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("apiException.mustache", invokerFolder, "ApiException.java")); supportingFiles.add(new SupportingFile("Configuration.mustache", invokerFolder, "Configuration.java")); supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java")); } - if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()))) { + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java")); } @@ -380,9 +395,19 @@ public class JavaClientCodegen extends AbstractJavaCodegen supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); supportingFiles.add(new SupportingFile("GsonObjectMapper.mustache", invokerFolder, "GsonObjectMapper.java")); } + supportingFiles.add(new SupportingFile("Oper.mustache", apiFolder, "Oper.java")); additionalProperties.put("convert", new CaseFormatLambda(LOWER_CAMEL, UPPER_UNDERSCORE)); apiTemplateFiles.put("api.mustache", ".java"); supportingFiles.add(new SupportingFile("ResponseSpecBuilders.mustache", invokerFolder, "ResponseSpecBuilders.java")); + } else if (MICROPROFILE.equals(getLibrary())) { + supportingFiles.clear(); // Don't need extra files provided by Java Codegen + String apiExceptionFolder = (sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar); + supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("api_exception.mustache", apiExceptionFolder, "ApiException.java")); + supportingFiles.add(new SupportingFile("api_exception_mapper.mustache", apiExceptionFolder, "ApiExceptionMapper.java")); + importMapping.put("LocalDate", "org.joda.time.LocalDate"); + serializationLibrary = "none"; } else { LOGGER.error("Unknown library option (-l/--library): " + getLibrary()); } @@ -541,11 +566,15 @@ public class JavaClientCodegen extends AbstractJavaCodegen } // google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer) - if ((!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || usePlayWS || NATIVE.equals(getLibrary()))) && ProcessUtils.hasOAuthMethods(objs)) { + if ((!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || usePlayWS || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) && ProcessUtils.hasOAuthMethods(objs)) { supportingFiles.add(new SupportingFile("auth/OAuth.mustache", authFolder, "OAuth.java")); supportingFiles.add(new SupportingFile("auth/OAuthFlow.mustache", authFolder, "OAuthFlow.java")); } + if (MICROPROFILE.equals(getLibrary())) { + objs = AbstractJavaJAXRSServerCodegen.jaxrsPostProcessOperations(objs); + } + return objs; } @@ -635,6 +664,23 @@ public class JavaClientCodegen extends AbstractJavaCodegen model.imports.add("JsonCreator"); } } + if (MICROPROFILE.equals(getLibrary())) { + model.imports.remove("ApiModelProperty"); + model.imports.remove("ApiModel"); + model.imports.remove("JsonSerialize"); + model.imports.remove("ToStringSerializer"); + } + } + @Override + public CodegenModel fromModel(String name, Schema model) { + CodegenModel codegenModel = super.fromModel(name, model); + if (MICROPROFILE.equals(getLibrary())) { + if (codegenModel.imports.contains("ApiModel")) { + // Remove io.swagger.annotations.ApiModel import + codegenModel.imports.remove("ApiModel"); + } + } + return codegenModel; } @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 96c5f9d35bd..9c1cee26850 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 @@ -131,7 +131,7 @@ public class SpringCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(SKIP_DEFAULT_INTERFACE, "Whether to generate default implementations for java8 interfaces", skipDefaultInterface)); 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)")); + cliOptions.add(new CliOption(RESPONSE_WRAPPER, "wrap the responses in given type (Future, Callable, CompletableFuture,ListenableFuture, DeferredResult, HystrixCommand, RxObservable, RxSingle or fully qualified type)")); cliOptions.add(CliOption.newBoolean(VIRTUAL_SERVICE, "Generates the virtual service. For more details refer - https://github.com/elan-venture/virtualan/wiki")); cliOptions.add(CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames", useTags)); cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations", useBeanValidation)); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java index da3b7078def..03d7ed690bf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java @@ -57,8 +57,10 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { public static final String LENIENT_TYPE_CAST = "lenientTypeCast"; protected static final String LIBRARY_PROMISE_KIT = "PromiseKit"; protected static final String LIBRARY_RX_SWIFT = "RxSwift"; - protected static final String[] RESPONSE_LIBRARIES = {LIBRARY_PROMISE_KIT, LIBRARY_RX_SWIFT}; + protected static final String LIBRARY_RESULT = "Result"; + protected static final String[] RESPONSE_LIBRARIES = {LIBRARY_PROMISE_KIT, LIBRARY_RX_SWIFT, LIBRARY_RESULT}; protected String projectName = "OpenAPIClient"; + protected boolean nonPublicApi = false; protected boolean unwrapRequired; protected boolean objcCompatible = false; protected boolean lenientTypeCast = false; @@ -208,6 +210,9 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { "Optionally use libraries to manage response. Currently " + StringUtils.join(RESPONSE_LIBRARIES, ", ") + " are available.")); + cliOptions.add(new CliOption(CodegenConstants.NON_PUBLIC_API, + CodegenConstants.NON_PUBLIC_API_DESC + + "(default: false)")); cliOptions.add(new CliOption(UNWRAP_REQUIRED, "Treat 'required' properties in response as non-optional " + "(which would crash the app if api returns null as opposed " @@ -329,6 +334,14 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { } sourceFolder = projectName + File.separator + sourceFolder; + // Setup nonPublicApi option, which generates code with reduced access + // modifiers; allows embedding elsewhere without exposing non-public API calls + // to consumers + if (additionalProperties.containsKey(CodegenConstants.NON_PUBLIC_API)) { + setNonPublicApi(convertPropertyToBooleanAndWriteBack(CodegenConstants.NON_PUBLIC_API)); + } + additionalProperties.put(CodegenConstants.NON_PUBLIC_API, nonPublicApi); + // Setup unwrapRequired option, which makes all the // properties with "required" non-optional if (additionalProperties.containsKey(UNWRAP_REQUIRED)) { @@ -364,6 +377,9 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { if (ArrayUtils.contains(responseAs, LIBRARY_RX_SWIFT)) { additionalProperties.put("useRxSwift", true); } + if (ArrayUtils.contains(responseAs, LIBRARY_RESULT)) { + additionalProperties.put("useResult", true); + } // Setup swiftUseApiNamespace option, which makes all the API // classes inner-class of {{projectName}}API @@ -417,6 +433,11 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("JSONEncodingHelper.mustache", sourceFolder, "JSONEncodingHelper.swift")); + if (ArrayUtils.contains(responseAs, LIBRARY_RESULT)) { + supportingFiles.add(new SupportingFile("Result.mustache", + sourceFolder, + "Result.swift")); + } supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); @@ -555,7 +576,11 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { public String toDefaultValue(Schema p) { if (p.getEnum() != null && !p.getEnum().isEmpty()) { if (p.getDefault() != null) { - return "." + escapeText((String) p.getDefault()); + if (ModelUtils.isStringSchema(p)) { + return "." + toEnumVarName(escapeText((String) p.getDefault()), p.getType()); + } else { + return "." + toEnumVarName(escapeText(p.getDefault().toString()), p.getType()); + } } } if (ModelUtils.isIntegerSchema(p) || ModelUtils.isNumberSchema(p) || ModelUtils.isBooleanSchema(p)) { @@ -714,6 +739,10 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { this.projectName = projectName; } + public void setNonPublicApi(boolean nonPublicApi) { + this.nonPublicApi = nonPublicApi; + } + public void setUnwrapRequired(boolean unwrapRequired) { this.unwrapRequired = unwrapRequired; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java index e6d906804f9..b5ccea1606c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java @@ -18,8 +18,10 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.responses.ApiResponse; + import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -112,7 +114,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen } return camelize(name) + apiSuffix; } - + @Override public String toApiFilename(String name) { if (name.length() == 0) { @@ -150,7 +152,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen return modelPackage() + "/" + camelize(toModelName(name), true); } - + @Override public Map postProcessAllModels(Map objs) { Map result = super.postProcessAllModels(objs); @@ -167,7 +169,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen } return result; } - + private List> toTsImports(CodegenModel cm, Set imports) { List> tsImports = new ArrayList<>(); for (String im : imports) { @@ -180,31 +182,31 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen } return tsImports; } - + @Override public Map postProcessOperationsWithModels(Map operations, List allModels) { Map objs = (Map) operations.get("operations"); - + // The api.mustache template requires all of the auth methods for the whole api // Loop over all the operations and pick out each unique auth method Map authMethodsMap = new HashMap<>(); for (CodegenOperation op : (List) objs.get("operation")) { - if(op.hasAuthMethods){ - for(CodegenSecurity sec : op.authMethods){ + if (op.hasAuthMethods) { + for (CodegenSecurity sec : op.authMethods) { authMethodsMap.put(sec.name, sec); } } } - + // If there wer any auth methods specified add them to the operations context if (!authMethodsMap.isEmpty()) { operations.put("authMethods", authMethodsMap.values()); operations.put("hasAuthMethods", true); } - + // Add filename information for api imports objs.put("apiFilename", getApiFilenameFromClassname(objs.get("classname").toString())); - + // Add additional filename information for model imports in the apis List> imports = (List>) operations.get("imports"); for (Map im : imports) { @@ -231,7 +233,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen supportingFiles.add(new SupportingFile("api.mustache", getIndexDirectory(), "api.ts")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); - + if (additionalProperties.containsKey(NPM_NAME)) { addNpmPackageGeneration(); } @@ -247,7 +249,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen supportingFiles.add(new SupportingFile("package.mustache", getPackageRootDirectory(), "package.json")); supportingFiles.add(new SupportingFile("tsconfig.mustache", getPackageRootDirectory(), "tsconfig.json")); } - + private String getIndexDirectory() { String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); return indexPackage.replace('.', File.separatorChar); @@ -270,7 +272,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen } return type; } - + private boolean isLanguagePrimitive(String type) { return languageSpecificPrimitives.contains(type); } @@ -289,14 +291,24 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); return indexPackage.replace('.', File.separatorChar); } - + private String getApiFilenameFromClassname(String classname) { String name = classname.substring(0, classname.length() - apiSuffix.length()); return toApiFilename(name); } - + private String getModelnameFromModelFilename(String filename) { String name = filename.substring((modelPackage() + File.separator).length()); return camelize(name); } +@Override + protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) { + super.addAdditionPropertiesToCodeGenModel(codegenModel, schema); + Schema additionalProperties = ModelUtils.getAdditionalProperties(schema); + codegenModel.additionalPropertiesType = getSchemaType(additionalProperties); + if ("array".equalsIgnoreCase(codegenModel.additionalPropertiesType)) { + codegenModel.additionalPropertiesType += '<' + getSchemaType(((ArraySchema) additionalProperties).getItems()) + '>'; + } + addImport(codegenModel, codegenModel.additionalPropertiesType); + } } 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 26b0b6539a9..780857f606c 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 @@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -54,7 +55,6 @@ public class ModelUtils { return Boolean.parseBoolean(GlobalSettings.getProperty(generateAliasAsModelKey, "false")); } - /** * Searches for the model by name in the map of models and returns it * @@ -117,7 +117,18 @@ public class ModelUtils { * @return schemas a list of unused schemas */ public static List getUnusedSchemas(OpenAPI openAPI) { - Map> childrenMap = getChildrenMap(openAPI); + final Map> childrenMap; + Map> tmpChildrenMap; + try { + tmpChildrenMap = getChildrenMap(openAPI); + } catch (NullPointerException npe) { + // in rare cases, such as a spec document with only one top-level oneOf schema and multiple referenced schemas, + // the stream used in getChildrenMap will raise an NPE. Rather than modify getChildrenMap which is used by getAllUsedSchemas, + // we'll catch here as a workaround for this edge case. + tmpChildrenMap = new HashMap<>(); + } + + childrenMap = tmpChildrenMap; List unusedSchemas = new ArrayList(); Map schemas = getSchemas(openAPI); @@ -875,6 +886,7 @@ public class ModelUtils { public static Map> getChildrenMap(OpenAPI openAPI) { Map allSchemas = getSchemas(openAPI); + // FIXME: The collect here will throw NPE if a spec document has only a single oneOf hierarchy. Map>> groupedByParent = allSchemas.entrySet().stream() .filter(entry -> isComposedSchema(entry.getValue())) .collect(Collectors.groupingBy(entry -> getParentName((ComposedSchema) entry.getValue(), allSchemas))); diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache index ac95c7ace7e..c6f29bc4918 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache @@ -50,7 +50,7 @@ void apiClient_free(apiClient_t *apiClient) { } {{/isOAuth}} {{#isApiKey}} - if(apiClient->accessToken) { + if(apiClient->apiKeys) { list_free(apiClient->apiKeys); } {{/isApiKey}} diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache index eafb8a326a8..527c1b24350 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache @@ -74,17 +74,17 @@ return 0; {{^isContainer}} {{^isModel}} {{#isEnum}} - char* {{baseName}}{{classname}}_ToString({{baseName}}_e {{baseName}}){ - char *{{baseName}}Array[] = { {{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} }; - return {{baseName}}Array[{{baseName}}]; + char* {{name}}{{classname}}_ToString({{name}}_e {{name}}){ + char *{{name}}Array[] = { {{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} }; + return {{name}}Array[{{name}}]; } - {{baseName}}_e {{baseName}}{{classname}}_FromString(char* {{baseName}}){ + {{name}}_e {{name}}{{classname}}_FromString(char* {{name}}){ int stringToReturn = 0; - char *{{baseName}}Array[] = { {{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} }; - size_t sizeofArray = sizeof({{baseName}}Array) / sizeof({{baseName}}Array[0]); + char *{{name}}Array[] = { {{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} }; + size_t sizeofArray = sizeof({{name}}Array) / sizeof({{name}}Array[0]); while(stringToReturn < sizeofArray) { - if(strcmp({{baseName}}, {{baseName}}Array[stringToReturn]) == 0) { + if(strcmp({{name}}, {{name}}Array[stringToReturn]) == 0) { return stringToReturn; } stringToReturn++; @@ -98,17 +98,17 @@ return 0; {{#items}} {{^isModel}} {{#isEnum}} - char* {{baseName}}{{classname}}_ToString({{baseName}}_e {{baseName}}){ - char *{{baseName}}Array[] = { {{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} }; - return {{baseName}}Array[{{baseName}} - 1]; + char* {{name}}{{classname}}_ToString({{name}}_e {{name}}){ + char *{{name}}Array[] = { {{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} }; + return {{name}}Array[{{name}} - 1]; } - {{baseName}}_e {{baseName}}{{classname}}_FromString(char* {{baseName}}){ + {{name}}_e {{name}}{{classname}}_FromString(char* {{name}}){ int stringToReturn = 0; - char *{{baseName}}Array[] = { {{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} }; - size_t sizeofArray = sizeof({{baseName}}Array) / sizeof({{baseName}}Array[0]); + char *{{name}}Array[] = { {{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} }; + size_t sizeofArray = sizeof({{name}}Array) / sizeof({{name}}Array[0]); while(stringToReturn < sizeofArray) { - if(strcmp({{baseName}}, {{baseName}}Array[stringToReturn]) == 0) { + if(strcmp({{name}}, {{name}}Array[stringToReturn]) == 0) { return stringToReturn + 1; } stringToReturn++; @@ -127,77 +127,77 @@ return 0; {{^isPrimitiveType}} {{#isModel}} {{#isEnum}} - {{datatype}}_e {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_e {{name}}{{#hasMore}},{{/hasMore}} {{/isEnum}} {{^isEnum}} - {{datatype}}_t *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} {{/isEnum}} {{/isModel}} {{#isUuid}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isUuid}} {{#isEmail}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isEmail}} {{#isFreeFormObject}} - {{datatype}}_t *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} {{/isFreeFormObject}} {{/isPrimitiveType}} {{#isPrimitiveType}} {{#isNumeric}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isNumeric}} {{#isBoolean}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isBoolean}} {{#isEnum}} {{#isString}} - {{baseName}}_e {{baseName}}{{#hasMore}},{{/hasMore}} + {{name}}_e {{name}}{{#hasMore}},{{/hasMore}} {{/isString}} {{/isEnum}} {{^isEnum}} {{#isString}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isString}} {{/isEnum}} {{#isByteArray}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isByteArray}} {{#isBinary}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isBinary}} {{#isDate}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isDate}} {{#isDateTime}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isDateTime}} {{/isPrimitiveType}} {{/isContainer}} {{#isContainer}} {{#isListContainer}} {{#isPrimitiveType}} - {{datatype}}_t *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} {{/isPrimitiveType}} {{^isPrimitiveType}} - {{datatype}}_t *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} {{/isPrimitiveType}} {{/isListContainer}} {{#isMapContainer}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isMapContainer}} {{/isContainer}} {{/vars}} ) { - {{classname}}_t *{{classname}}_local_var = malloc(sizeof({{classname}}_t)); + {{classname}}_t *{{classname}}_local_var = malloc(sizeof({{classname}}_t)); if (!{{classname}}_local_var) { return NULL; } - {{#vars}} - {{classname}}_local_var->{{{baseName}}} = {{{baseName}}}; - {{/vars}} + {{#vars}} + {{classname}}_local_var->{{{name}}} = {{{name}}}; + {{/vars}} - return {{classname}}_local_var; + return {{classname}}_local_var; } @@ -208,92 +208,92 @@ void {{classname}}_free({{classname}}_t *{{classname}}) { {{^isPrimitiveType}} {{#isModel}} {{^isEnum}} - {{{complexType}}}_free({{{classname}}}->{{{baseName}}}); + {{{complexType}}}_free({{{classname}}}->{{{name}}}); {{/isEnum}} {{/isModel}} {{#isUuid}} - free({{{classname}}}->{{{baseName}}}); + free({{{classname}}}->{{{name}}}); {{/isUuid}} {{#isEmail}} - free({{{classname}}}->{{{baseName}}}); + free({{{classname}}}->{{{name}}}); {{/isEmail}} {{#isFreeFormObject}} - object_free({{{classname}}}->{{{baseName}}}); + object_free({{{classname}}}->{{{name}}}); {{/isFreeFormObject}} {{/isPrimitiveType}} {{#isPrimitiveType}} {{^isEnum}} {{#isString}} - free({{{classname}}}->{{{baseName}}}); + free({{{classname}}}->{{{name}}}); {{/isString}} {{/isEnum}} {{#isBinary}} - free({{{classname}}}->{{{baseName}}}->data); + free({{{classname}}}->{{{name}}}->data); {{/isBinary}} {{#isDate}} - free({{{classname}}}->{{{baseName}}}); + free({{{classname}}}->{{{name}}}); {{/isDate}} {{#isDateTime}} - free({{{classname}}}->{{{baseName}}}); + free({{{classname}}}->{{{name}}}); {{/isDateTime}} {{/isPrimitiveType}} {{/isContainer}} {{#isContainer}} {{#isListContainer}} {{#isPrimitiveType}} - list_ForEach(listEntry, {{classname}}->{{baseName}}) { - free(listEntry->data); - } - list_free({{classname}}->{{baseName}}); + list_ForEach(listEntry, {{classname}}->{{name}}) { + free(listEntry->data); + } + list_free({{classname}}->{{name}}); {{/isPrimitiveType}} {{^isPrimitiveType}} - list_ForEach(listEntry, {{classname}}->{{baseName}}) { - {{complexType}}_free(listEntry->data); - } - list_free({{classname}}->{{baseName}}); + list_ForEach(listEntry, {{classname}}->{{name}}) { + {{complexType}}_free(listEntry->data); + } + list_free({{classname}}->{{name}}); {{/isPrimitiveType}} {{/isListContainer}} {{#isMapContainer}} - list_ForEach(listEntry, {{classname}}->{{baseName}}) { - keyValuePair_t *localMapKeyPair = (keyValuePair_t*) listEntry->data; + list_ForEach(listEntry, {{classname}}->{{name}}) { + keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data; free (localKeyValue->key); free (localKeyValue->value); - } - list_free({{classname}}->{{baseName}}); + } + list_free({{classname}}->{{name}}); {{/isMapContainer}} {{/isContainer}} {{/vars}} - free({{classname}}); + free({{classname}}); } cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) { - cJSON *item = cJSON_CreateObject(); - {{#vars}} + cJSON *item = cJSON_CreateObject(); + {{#vars}} - // {{{classname}}}->{{{baseName}}} + // {{{classname}}}->{{{name}}} {{#required}} {{^isEnum}} - if (!{{{classname}}}->{{{baseName}}}) { + if (!{{{classname}}}->{{{name}}}) { goto fail; } {{/isEnum}} {{/required}} - {{^required}}{{^isEnum}}if({{{classname}}}->{{{baseName}}}) { {{/isEnum}}{{/required}} - {{^isContainer}} - {{#isPrimitiveType}} + {{^required}}{{^isEnum}}if({{{classname}}}->{{{name}}}) { {{/isEnum}}{{/required}} + {{^isContainer}} + {{#isPrimitiveType}} {{#isNumeric}} - if(cJSON_AddNumberToObject(item, "{{{baseName}}}", {{{classname}}}->{{{baseName}}}) == NULL) { + if(cJSON_AddNumberToObject(item, "{{{name}}}", {{{classname}}}->{{{name}}}) == NULL) { goto fail; //Numeric } {{/isNumeric}} {{#isBoolean}} - if(cJSON_AddBoolToObject(item, "{{{baseName}}}", {{{classname}}}->{{{baseName}}}) == NULL) { + if(cJSON_AddBoolToObject(item, "{{{name}}}", {{{classname}}}->{{{name}}}) == NULL) { goto fail; //Bool } {{/isBoolean}} {{#isEnum}} {{#isString}} - if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{{baseName}}}{{classname}}_ToString({{{classname}}}->{{{baseName}}})) == NULL) + if(cJSON_AddStringToObject(item, "{{{name}}}", {{{name}}}{{classname}}_ToString({{{classname}}}->{{{name}}})) == NULL) { goto fail; //Enum } @@ -301,133 +301,133 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) { {{/isEnum}} {{^isEnum}} {{#isString}} - if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{baseName}}}) == NULL) { + if(cJSON_AddStringToObject(item, "{{{name}}}", {{{classname}}}->{{{name}}}) == NULL) { goto fail; //String } {{/isString}} {{/isEnum}} {{#isByteArray}} - if(cJSON_AddNumberToObject(item, "{{{baseName}}}", {{{classname}}}->{{{baseName}}}) == NULL) { + if(cJSON_AddNumberToObject(item, "{{{name}}}", {{{classname}}}->{{{name}}}) == NULL) { goto fail; //Byte } {{/isByteArray}} {{#isBinary}} - char* encoded_str_{{{baseName}}} = base64encode({{{classname}}}->{{{baseName}}}->data,{{{classname}}}->{{{baseName}}}->len); - if(cJSON_AddStringToObject(item, "{{{baseName}}}", encoded_str_{{{baseName}}}) == NULL) { + char* encoded_str_{{{name}}} = base64encode({{{classname}}}->{{{name}}}->data,{{{classname}}}->{{{name}}}->len); + if(cJSON_AddStringToObject(item, "{{{name}}}", encoded_str_{{{name}}}) == NULL) { goto fail; //Binary } - free (encoded_str_{{{baseName}}}); + free (encoded_str_{{{name}}}); {{/isBinary}} {{#isDate}} - if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{baseName}}}) == NULL) { + if(cJSON_AddStringToObject(item, "{{{name}}}", {{{classname}}}->{{{name}}}) == NULL) { goto fail; //Date } {{/isDate}} {{#isDateTime}} - if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{baseName}}}) == NULL) { + if(cJSON_AddStringToObject(item, "{{{name}}}", {{{classname}}}->{{{name}}}) == NULL) { goto fail; //Date-Time } {{/isDateTime}} - {{/isPrimitiveType}} - {{^isPrimitiveType}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} {{#isModel}} {{#isEnum}} - cJSON *{{{baseName}}}_enum_local_JSON = {{datatypeWithEnum}}_convertToJSON({{{classname}}}->{{{baseName}}}); - if({{{baseName}}}_enum_local_JSON == NULL) { + cJSON *{{{name}}}_enum_local_JSON = {{datatypeWithEnum}}_convertToJSON({{{classname}}}->{{{name}}}); + if({{{name}}}_enum_local_JSON == NULL) { goto fail; // enum } - cJSON_AddItemToObject(item, "{{{baseName}}}", {{{baseName}}}_enum_local_JSON); + cJSON_AddItemToObject(item, "{{{name}}}", {{{name}}}_enum_local_JSON); if(item->child == NULL) { goto fail; } {{/isEnum}} {{^isEnum}} - cJSON *{{{baseName}}}_local_JSON = {{complexType}}{{#isFreeFormObject}}object{{/isFreeFormObject}}_convertToJSON({{{classname}}}->{{{baseName}}}); - if({{{baseName}}}_local_JSON == NULL) { + cJSON *{{{name}}}_local_JSON = {{complexType}}{{#isFreeFormObject}}object{{/isFreeFormObject}}_convertToJSON({{{classname}}}->{{{name}}}); + if({{{name}}}_local_JSON == NULL) { goto fail; //model } - cJSON_AddItemToObject(item, "{{{baseName}}}", {{{baseName}}}_local_JSON); + cJSON_AddItemToObject(item, "{{{name}}}", {{{name}}}_local_JSON); if(item->child == NULL) { goto fail; } {{/isEnum}} {{/isModel}} {{#isUuid}} - if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{baseName}}}) == NULL) { + if(cJSON_AddStringToObject(item, "{{{name}}}", {{{classname}}}->{{{name}}}) == NULL) { goto fail; //uuid } {{/isUuid}} {{#isEmail}} - if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{baseName}}}) == NULL) { + if(cJSON_AddStringToObject(item, "{{{name}}}", {{{classname}}}->{{{name}}}) == NULL) { goto fail; //Email } {{/isEmail}} {{#isFreeFormObject}} - cJSON *{{{baseName}}}_object = object_convertToJSON({{{classname}}}->{{{baseName}}}); - if({{{baseName}}}_object == NULL) { + cJSON *{{{name}}}_object = object_convertToJSON({{{classname}}}->{{{name}}}); + if({{{name}}}_object == NULL) { goto fail; //model } - cJSON_AddItemToObject(item, "{{{baseName}}}", {{{baseName}}}_object); + cJSON_AddItemToObject(item, "{{{name}}}", {{{name}}}_object); if(item->child == NULL) { goto fail; } {{/isFreeFormObject}} - {{/isPrimitiveType}} - {{/isContainer}} - {{#isContainer}} - {{#isListContainer}} - {{#isPrimitiveType}} - cJSON *{{{name}}} = cJSON_AddArrayToObject(item, "{{{baseName}}}"); - if({{{name}}} == NULL) { - goto fail; //primitive container - } + {{/isPrimitiveType}} + {{/isContainer}} + {{#isContainer}} + {{#isListContainer}} + {{#isPrimitiveType}} + cJSON *{{{name}}} = cJSON_AddArrayToObject(item, "{{{name}}}"); + if({{{name}}} == NULL) { + goto fail; //primitive container + } - listEntry_t *{{{name}}}ListEntry; - list_ForEach({{{name}}}ListEntry, {{{classname}}}->{{{baseName}}}) { + listEntry_t *{{{name}}}ListEntry; + list_ForEach({{{name}}}ListEntry, {{{classname}}}->{{{name}}}) { {{#items}} {{#isString}} - if(cJSON_AddStringToObject({{{baseName}}}, "", (char*){{{baseName}}}ListEntry->data) == NULL) + if(cJSON_AddStringToObject({{{name}}}, "", (char*){{{name}}}ListEntry->data) == NULL) { goto fail; } {{/isString}} {{^isString}} - if(cJSON_AddNumberToObject({{{baseName}}}, "", *(double *){{{baseName}}}ListEntry->data) == NULL) + if(cJSON_AddNumberToObject({{{name}}}, "", *(double *){{{name}}}ListEntry->data) == NULL) { goto fail; } {{/isString}} {{/items}} } - {{/isPrimitiveType}} - {{^isPrimitiveType}} - cJSON *{{{baseName}}} = cJSON_AddArrayToObject(item, "{{{baseName}}}"); - if({{{baseName}}} == NULL) { + {{/isPrimitiveType}} + {{^isPrimitiveType}} + cJSON *{{{name}}} = cJSON_AddArrayToObject(item, "{{{name}}}"); + if({{{name}}} == NULL) { goto fail; //nonprimitive container } - listEntry_t *{{{baseName}}}ListEntry; - if ({{{classname}}}->{{{baseName}}}) { - list_ForEach({{{baseName}}}ListEntry, {{classname}}->{{{baseName}}}) { - cJSON *itemLocal = {{complexType}}_convertToJSON({{#isEnum}}{{#items}}({{datatypeWithEnum}}_e){{/items}}{{/isEnum}}{{{baseName}}}ListEntry->data); + listEntry_t *{{{name}}}ListEntry; + if ({{{classname}}}->{{{name}}}) { + list_ForEach({{{name}}}ListEntry, {{classname}}->{{{name}}}) { + cJSON *itemLocal = {{complexType}}_convertToJSON({{#isEnum}}{{#items}}({{datatypeWithEnum}}_e){{/items}}{{/isEnum}}{{{name}}}ListEntry->data); if(itemLocal == NULL) { goto fail; } - cJSON_AddItemToArray({{{baseName}}}, itemLocal); + cJSON_AddItemToArray({{{name}}}, itemLocal); } } - {{/isPrimitiveType}} - {{/isListContainer}} - {{#isMapContainer}} - cJSON *{{{baseName}}} = cJSON_AddObjectToObject(item, "{{{baseName}}}"); - if({{{baseName}}} == NULL) { - goto fail; //primitive map container - } + {{/isPrimitiveType}} + {{/isListContainer}} + {{#isMapContainer}} + cJSON *{{{name}}} = cJSON_AddObjectToObject(item, "{{{name}}}"); + if({{{name}}} == NULL) { + goto fail; //primitive map container + } cJSON *localMapObject = cJSON_CreateObject(); //Memory free to be implemented in user code - listEntry_t *{{{baseName}}}ListEntry; - if ({{{classname}}}->{{{baseName}}}) { - list_ForEach({{{baseName}}}ListEntry, {{{classname}}}->{{{baseName}}}) { - keyValuePair_t *localKeyValue = (keyValuePair_t*){{{baseName}}}ListEntry->data; + listEntry_t *{{{name}}}ListEntry; + if ({{{classname}}}->{{{name}}}) { + list_ForEach({{{name}}}ListEntry, {{{classname}}}->{{{name}}}) { + keyValuePair_t *localKeyValue = (keyValuePair_t*){{{name}}}ListEntry->data; {{#items}} {{#isString}} if(cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL) @@ -442,22 +442,22 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) { } {{/isString}} {{/items}} - cJSON_AddItemToObject({{{baseName}}},"", localMapObject); + cJSON_AddItemToObject({{{name}}},"", localMapObject); } } - {{/isMapContainer}} - {{/isContainer}} - {{^required}} + {{/isMapContainer}} + {{/isContainer}} + {{^required}} {{^isEnum}} } {{/isEnum}} - {{/required}} + {{/required}} {{/vars}} - return item; + return item; fail: - if (item) { + if (item) { cJSON_Delete(item); } - return NULL; + return NULL; } {{classname}}_t *{{classname}}_parseFromJSON(cJSON *{{classname}}JSON){ @@ -465,10 +465,10 @@ fail: {{classname}}_t *{{classname}}_local_var = NULL; {{#vars}} - // {{{classname}}}->{{{baseName}}} - cJSON *{{{baseName}}} = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{baseName}}}"); + // {{{classname}}}->{{{name}}} + cJSON *{{{name}}} = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{name}}}"); {{#required}} - if (!{{{baseName}}}) { + if (!{{{name}}}) { goto end; } @@ -476,71 +476,71 @@ fail: {{^isContainer}} {{#isPrimitiveType}} {{#isNumeric}} - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsNumber({{{baseName}}})) + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsNumber({{{name}}})) { goto end; //Numeric } {{/isNumeric}} {{#isBoolean}} - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsBool({{{baseName}}})) + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsBool({{{name}}})) { goto end; //Bool } {{/isBoolean}} {{#isEnum}} {{#isString}} - {{{baseName}}}_e {{baseName}}Variable; - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsString({{{baseName}}})) + {{{name}}}_e {{name}}Variable; + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsString({{{name}}})) { goto end; //Enum } - {{baseName}}Variable = {{baseName}}{{classname}}_FromString({{{baseName}}}->valuestring); + {{name}}Variable = {{name}}{{classname}}_FromString({{{name}}}->valuestring); {{/isString}} {{/isEnum}} {{^isEnum}} {{#isString}} - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsString({{{baseName}}})) + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsString({{{name}}})) { goto end; //String } {{/isString}} {{/isEnum}} {{#isByteArray}} - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsNumber({{{baseName}}})) + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsNumber({{{name}}})) { goto end; //Byte } {{/isByteArray}} {{#isBinary}} - binary_t* decoded_str_{{{baseName}}}; - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsString({{{baseName}}})) + binary_t* decoded_str_{{{name}}}; + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsString({{{name}}})) { goto end; //Binary } - char* decoded = base64decode({{{baseName}}}->valuestring, strlen({{{baseName}}}->valuestring)); - decoded_str_{{{baseName}}}->data = malloc(strlen(decoded) - 1); - if (!decoded_str_{{{baseName}}}->data) { - goto end; - } - memcpy(decoded_str_{{{baseName}}}->data,decoded,(strlen(decoded)-1)); - decoded_str_{{{baseName}}}->len = strlen(decoded) - 1; + char* decoded = base64decode({{{name}}}->valuestring, strlen({{{name}}}->valuestring)); + decoded_str_{{{name}}}->data = malloc(strlen(decoded) - 1); + if (!decoded_str_{{{name}}}->data) { + goto end; + } + memcpy(decoded_str_{{{name}}}->data,decoded,(strlen(decoded)-1)); + decoded_str_{{{name}}}->len = strlen(decoded) - 1; {{/isBinary}} {{#isDate}} - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsString({{{baseName}}})) + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsString({{{name}}})) { goto end; //Date } {{/isDate}} {{#isDateTime}} - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsString({{{baseName}}})) + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsString({{{name}}})) { goto end; //DateTime } @@ -549,34 +549,34 @@ fail: {{^isPrimitiveType}} {{#isModel}} {{#isEnum}} - {{datatypeWithEnum}}_e {{baseName}}_local_nonprim_enum; - {{^required}}if ({{{baseName}}}) { {{/required}} - {{{baseName}}}_local_nonprim_enum = {{datatypeWithEnum}}_parseFromJSON({{{baseName}}}); //enum model + {{datatypeWithEnum}}_e {{name}}_local_nonprim_enum; + {{^required}}if ({{{name}}}) { {{/required}} + {{{name}}}_local_nonprim_enum = {{datatypeWithEnum}}_parseFromJSON({{{name}}}); //enum model {{/isEnum}} {{^isEnum}} - {{^isFreeFormObject}}{{complexType}}{{/isFreeFormObject}}{{#isFreeFormObject}}object{{/isFreeFormObject}}_t *{{baseName}}_local_nonprim = NULL; - {{^required}}if ({{{baseName}}}) { {{/required}} - {{{baseName}}}_local_nonprim = {{complexType}}{{#isFreeFormObject}}object{{/isFreeFormObject}}_parseFromJSON({{{baseName}}}); //nonprimitive + {{^isFreeFormObject}}{{complexType}}{{/isFreeFormObject}}{{#isFreeFormObject}}object{{/isFreeFormObject}}_t *{{name}}_local_nonprim = NULL; + {{^required}}if ({{{name}}}) { {{/required}} + {{{name}}}_local_nonprim = {{complexType}}{{#isFreeFormObject}}object{{/isFreeFormObject}}_parseFromJSON({{{name}}}); //nonprimitive {{/isEnum}} {{/isModel}} {{#isUuid}} - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsString({{{baseName}}})) + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsString({{{name}}})) { goto end; //uuid } {{/isUuid}} {{#isEmail}} - {{^required}}if ({{{baseName}}}) { {{/required}} - if(!cJSON_IsString({{{baseName}}})) + {{^required}}if ({{{name}}}) { {{/required}} + if(!cJSON_IsString({{{name}}})) { goto end; //email } {{/isEmail}} {{#isFreeFormObject}} - object_t *{{baseName}}_local_object = NULL; - {{^required}}if ({{{baseName}}}) { {{/required}} - {{{baseName}}}_local_object = object_parseFromJSON({{{baseName}}}); //object + object_t *{{name}}_local_object = NULL; + {{^required}}if ({{{name}}}) { {{/required}} + {{{name}}}_local_object = object_parseFromJSON({{{name}}}); //object {{/isFreeFormObject}} {{/isPrimitiveType}} {{/isContainer}} @@ -584,64 +584,64 @@ fail: {{#isListContainer}} {{#isPrimitiveType}} list_t *{{{name}}}List; - {{^required}}if ({{{baseName}}}) { {{/required}} + {{^required}}if ({{{name}}}) { {{/required}} cJSON *{{{name}}}_local; - if(!cJSON_IsArray({{{baseName}}})) { + if(!cJSON_IsArray({{{name}}})) { goto end;//primitive container } {{{name}}}List = list_create(); - cJSON_ArrayForEach({{{name}}}_local, {{{baseName}}}) + cJSON_ArrayForEach({{{name}}}_local, {{{name}}}) { {{#items}} {{#isString}} - if(!cJSON_IsString({{{baseName}}}_local)) + if(!cJSON_IsString({{{name}}}_local)) { goto end; } - list_addElement({{{baseName}}}List , strdup({{{baseName}}}_local->valuestring)); + list_addElement({{{name}}}List , strdup({{{name}}}_local->valuestring)); {{/isString}} {{^isString}} - if(!cJSON_IsNumber({{{baseName}}}_local)) + if(!cJSON_IsNumber({{{name}}}_local)) { goto end; } - list_addElement({{{baseName}}}List , &{{{baseName}}}_local->valuedouble); + list_addElement({{{name}}}List , &{{{name}}}_local->valuedouble); {{/isString}} {{/items}} } {{/isPrimitiveType}} {{^isPrimitiveType}} - list_t *{{{baseName}}}List; - {{^required}}if ({{{baseName}}}) { {{/required}} - cJSON *{{{baseName}}}_local_nonprimitive; - if(!cJSON_IsArray({{{baseName}}})){ + list_t *{{{name}}}List; + {{^required}}if ({{{name}}}) { {{/required}} + cJSON *{{{name}}}_local_nonprimitive; + if(!cJSON_IsArray({{{name}}})){ goto end; //nonprimitive container } - {{{baseName}}}List = list_create(); + {{{name}}}List = list_create(); - cJSON_ArrayForEach({{{baseName}}}_local_nonprimitive,{{{baseName}}} ) + cJSON_ArrayForEach({{{name}}}_local_nonprimitive,{{{name}}} ) { - if(!cJSON_IsObject({{{baseName}}}_local_nonprimitive)){ + if(!cJSON_IsObject({{{name}}}_local_nonprimitive)){ goto end; } - {{#isEnum}}{{#items}}{{datatypeWithEnum}}_e {{/items}}{{/isEnum}}{{^isEnum}}{{complexType}}_t *{{/isEnum}}{{{baseName}}}Item = {{complexType}}_parseFromJSON({{{baseName}}}_local_nonprimitive); + {{#isEnum}}{{#items}}{{datatypeWithEnum}}_e {{/items}}{{/isEnum}}{{^isEnum}}{{complexType}}_t *{{/isEnum}}{{{name}}}Item = {{complexType}}_parseFromJSON({{{name}}}_local_nonprimitive); - list_addElement({{{baseName}}}List, {{#isEnum}}{{#items}}(void *){{/items}}{{/isEnum}}{{{baseName}}}Item); + list_addElement({{{name}}}List, {{#isEnum}}{{#items}}(void *){{/items}}{{/isEnum}}{{{name}}}Item); } {{/isPrimitiveType}} {{/isListContainer}} {{#isMapContainer}} list_t *{{{complexType}}}List; - {{^required}}if ({{{baseName}}}) { {{/required}} + {{^required}}if ({{{name}}}) { {{/required}} cJSON *{{{complexType}}}_local_map; - if(!cJSON_IsObject({{{baseName}}})) { + if(!cJSON_IsObject({{{name}}})) { goto end;//primitive map container } {{{complexType}}}List = list_create(); keyValuePair_t *localMapKeyPair; - cJSON_ArrayForEach({{{complexType}}}_local_map, {{{baseName}}}) + cJSON_ArrayForEach({{{complexType}}}_local_map, {{{name}}}) { {{#isString}} if(!cJSON_IsString({{{complexType}}}_local_map)) @@ -674,64 +674,64 @@ fail: {{^isPrimitiveType}} {{#isModel}} {{#isEnum}} - {{^required}}{{{baseName}}} ? {{/required}}{{{baseName}}}_local_nonprim_enum{{^required}} : -1{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}_local_nonprim_enum{{^required}} : -1{{/required}}{{#hasMore}},{{/hasMore}} {{/isEnum}} {{^isEnum}} - {{^required}}{{{baseName}}} ? {{/required}}{{{baseName}}}_local_nonprim{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}_local_nonprim{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isEnum}} {{/isModel}} {{#isUuid}} - {{^required}}{{{baseName}}} ? {{/required}}strdup({{{baseName}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isUuid}} {{#isEmail}} - {{^required}}{{{baseName}}} ? {{/required}}strdup({{{baseName}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isEmail}} {{#isFreeFormObject}} - {{^required}}{{{baseName}}} ? {{/required}}{{{baseName}}}_local_object{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}_local_object{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isFreeFormObject}} {{/isPrimitiveType}} {{#isPrimitiveType}} {{#isNumeric}} - {{^required}}{{{baseName}}} ? {{/required}}{{{baseName}}}->valuedouble{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}->valuedouble{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} {{/isNumeric}} {{#isBoolean}} - {{^required}}{{{baseName}}} ? {{/required}}{{{baseName}}}->valueint{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}->valueint{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} {{/isBoolean}} {{#isEnum}} {{#isString}} - {{^required}}{{{baseName}}} ? {{/required}}{{baseName}}Variable{{^required}} : -1{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{name}}Variable{{^required}} : -1{{/required}}{{#hasMore}},{{/hasMore}} {{/isString}} {{/isEnum}} {{^isEnum}} {{#isString}} - {{^required}}{{{baseName}}} ? {{/required}}strdup({{{baseName}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isString}} {{/isEnum}} {{#isByteArray}} - {{^required}}{{{baseName}}} ? {{/required}}{{{baseName}}}->valueint{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}->valueint{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} {{/isByteArray}} {{#isBinary}} - {{^required}}{{{baseName}}} ? {{/required}}decoded_str_{{{baseName}}}{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}decoded_str_{{{name}}}{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isBinary}} {{#isDate}} - {{^required}}{{{baseName}}} ? {{/required}}strdup({{{baseName}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isDate}} {{#isDateTime}} - {{^required}}{{{baseName}}} ? {{/required}}strdup({{{baseName}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isDateTime}} {{/isPrimitiveType}} {{/isContainer}} {{#isContainer}} {{#isListContainer}} {{#isPrimitiveType}} - {{^required}}{{{baseName}}} ? {{/required}}{{{name}}}List{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}List{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isPrimitiveType}} {{^isPrimitiveType}} - {{^required}}{{{baseName}}} ? {{/required}}{{{baseName}}}List{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}List{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isPrimitiveType}} {{/isListContainer}} {{#isMapContainer}} - {{^required}}{{{baseName}}} ? {{/required}}{{{complexType}}}List{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{^required}}{{{name}}} ? {{/required}}{{{complexType}}}List{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} {{/isMapContainer}} {{/isContainer}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache index a67e2fbd6c2..780e148cbae 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache @@ -36,12 +36,12 @@ cJSON *{{classname}}_convertToJSON({{classname}}_e {{classname}}); {{^isModel}} {{#isEnum}} {{#allowableValues}} - typedef enum { {{#enumVars}} {{{value}}}{{#first}} = 0{{/first}}{{^-last}},{{/-last}}{{/enumVars}} } {{baseName}}_e; + typedef enum { {{#enumVars}} {{{value}}}{{#first}} = 0{{/first}}{{^-last}},{{/-last}}{{/enumVars}} } {{name}}_e; {{/allowableValues}} - char* {{baseName}}_ToString({{baseName}}_e {{baseName}}); + char* {{name}}_ToString({{name}}_e {{name}}); - {{baseName}}_e {{baseName}}_FromString(char* {{baseName}}); + {{name}}_e {{name}}_FromString(char* {{name}}); {{/isEnum}} {{/isModel}} {{/isContainer}} @@ -50,12 +50,12 @@ cJSON *{{classname}}_convertToJSON({{classname}}_e {{classname}}); {{^isModel}} {{#isEnum}} {{#allowableValues}} - typedef enum { {{#enumVars}} {{{value}}}{{^-last}},{{/-last}}{{/enumVars}} } {{baseName}}_e; + typedef enum { {{#enumVars}} {{{value}}}{{^-last}},{{/-last}}{{/enumVars}} } {{name}}_e; {{/allowableValues}} - char* {{baseName}}_ToString({{baseName}}_e {{baseName}}); + char* {{name}}_ToString({{name}}_e {{name}}); - {{baseName}}_e {{baseName}}_FromString(char* {{baseName}}); + {{name}}_e {{name}}_FromString(char* {{name}}); {{/isEnum}} {{/isModel}} {{/items}} @@ -69,64 +69,64 @@ typedef struct {{classname}}_t { {{^isPrimitiveType}} {{#isModel}} {{#isEnum}} - {{datatype}}_e {{baseName}}; //enum model + {{datatype}}_e {{name}}; //enum model {{/isEnum}} {{^isEnum}} - {{datatype}}_t *{{baseName}}; //model + {{datatype}}_t *{{name}}; //model {{/isEnum}} {{/isModel}} {{#isUuid}} - {{datatype}} *{{baseName}}; // uuid + {{datatype}} *{{name}}; // uuid {{/isUuid}} {{#isEmail}} - {{datatype}} *{{baseName}}; // email + {{datatype}} *{{name}}; // email {{/isEmail}} {{#isFreeFormObject}} - {{datatype}}_t *{{baseName}}; //object + {{datatype}}_t *{{name}}; //object {{/isFreeFormObject}} {{/isPrimitiveType}} {{#isPrimitiveType}} {{#isNumeric}} - {{datatype}} {{baseName}}; //numeric + {{datatype}} {{name}}; //numeric {{/isNumeric}} {{#isBoolean}} - {{datatype}} {{baseName}}; //boolean + {{datatype}} {{name}}; //boolean {{/isBoolean}} {{#isEnum}} {{#isString}} - {{baseName}}_e {{baseName}}; //enum + {{name}}_e {{name}}; //enum {{/isString}} {{/isEnum}} {{^isEnum}} {{#isString}} - {{datatype}} *{{baseName}}; // string + {{datatype}} *{{name}}; // string {{/isString}} {{/isEnum}} {{#isByteArray}} - {{datatype}} {{baseName}}; //Byte + {{datatype}} {{name}}; //Byte {{/isByteArray}} {{#isBinary}} - {{datatype}} {{baseName}}; //binary + {{datatype}} {{name}}; //binary {{/isBinary}} {{#isDate}} - {{datatype}} *{{baseName}}; //date + {{datatype}} *{{name}}; //date {{/isDate}} {{#isDateTime}} - {{datatype}} *{{baseName}}; //date time + {{datatype}} *{{name}}; //date time {{/isDateTime}} {{/isPrimitiveType}} {{/isContainer}} {{#isContainer}} {{#isListContainer}} {{#isPrimitiveType}} - {{datatype}}_t *{{baseName}}; //primitive container + {{datatype}}_t *{{name}}; //primitive container {{/isPrimitiveType}} {{^isPrimitiveType}} - {{datatype}}_t *{{baseName}}; //nonprimitive container + {{datatype}}_t *{{name}}; //nonprimitive container {{/isPrimitiveType}} {{/isListContainer}} {{#isMapContainer}} - {{datatype}} {{baseName}}; //map + {{datatype}} {{name}}; //map {{/isMapContainer}} {{/isContainer}} {{/vars}} @@ -139,64 +139,64 @@ typedef struct {{classname}}_t { {{^isPrimitiveType}} {{#isModel}} {{#isEnum}} - {{datatype}}_e {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_e {{name}}{{#hasMore}},{{/hasMore}} {{/isEnum}} {{^isEnum}} - {{datatype}}_t *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} {{/isEnum}} {{/isModel}} {{#isUuid}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isUuid}} {{#isEmail}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isEmail}} {{#isFreeFormObject}} - {{datatype}}_t *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} {{/isFreeFormObject}} {{/isPrimitiveType}} {{#isPrimitiveType}} {{#isNumeric}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isNumeric}} {{#isBoolean}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isBoolean}} {{#isEnum}} {{#isString}} - {{baseName}}_e {{baseName}}{{#hasMore}},{{/hasMore}} + {{name}}_e {{name}}{{#hasMore}},{{/hasMore}} {{/isString}} {{/isEnum}} {{^isEnum}} {{#isString}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isString}} {{/isEnum}} {{#isByteArray}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isByteArray}} {{#isBinary}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isBinary}} {{#isDate}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isDate}} {{#isDateTime}} - {{datatype}} *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} {{/isDateTime}} {{/isPrimitiveType}} {{/isContainer}} {{#isContainer}} {{#isListContainer}} {{#isPrimitiveType}} - {{datatype}}_t *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} {{/isPrimitiveType}} {{^isPrimitiveType}} - {{datatype}}_t *{{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} {{/isPrimitiveType}} {{/isListContainer}} {{#isMapContainer}} - {{datatype}} {{baseName}}{{#hasMore}},{{/hasMore}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} {{/isMapContainer}} {{/isContainer}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/Java/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/Java/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.jar b/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.jar and b/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.jar differ diff --git a/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.properties.mustache b/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.properties.mustache index e496c054f69..94920145f34 100644 --- a/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.properties.mustache +++ b/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.properties.mustache @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/modules/openapi-generator/src/main/resources/Java/gradlew.bat.mustache b/modules/openapi-generator/src/main/resources/Java/gradlew.bat.mustache index f9553162f12..9618d8d9607 100644 --- a/modules/openapi-generator/src/main/resources/Java/gradlew.bat.mustache +++ b/modules/openapi-generator/src/main/resources/Java/gradlew.bat.mustache @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/modules/openapi-generator/src/main/resources/Java/gradlew.mustache b/modules/openapi-generator/src/main/resources/Java/gradlew.mustache index af6708ff229..2fe81a7d95e 100755 --- a/modules/openapi-generator/src/main/resources/Java/gradlew.mustache +++ b/modules/openapi-generator/src/main/resources/Java/gradlew.mustache @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/src/main/resources/Java/libraries/microprofile/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/README.mustache new file mode 100644 index 00000000000..576e70fe8ba --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/README.mustache @@ -0,0 +1,10 @@ +# {{appName}} - MicroProfile Rest Client + +{{#appDescription}} +{{{appDescription}}} + +{{/appDescription}} +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +[MicroProfile Rest Client](https://github.com/eclipse/microprofile-rest-client) is a type-safe way of calling +REST services. The generated client contains an interface which acts as the client, you can inject it into dependent classes. diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache new file mode 100644 index 00000000000..1830838da8e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache @@ -0,0 +1,61 @@ +{{>licenseInfo}} +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +{{^disableMultipart}} +import org.apache.cxf.jaxrs.ext.multipart.*; +{{/disableMultipart}} + +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +{{#appName}} +/** + * {{{appName}}} + * + {{#appDescription}} + *

{{{appDescription}}} + * + {{/appDescription}} + */ +{{/appName}} + +@RegisterRestClient +@RegisterProvider(ApiExceptionMapper.class) +@Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}") +public interface {{classname}} { +{{#operations}} +{{#operation}} + + {{#summary}} + /** + * {{summary}} + * + {{#notes}} + * {{notes}} + * + {{/notes}} + */ + {{/summary}} + @{{httpMethod}} + {{#subresourceOperation}}@Path("{{{path}}}"){{/subresourceOperation}} +{{#hasConsumes}} + @Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }) +{{/hasConsumes}} +{{#hasProduces}} + @Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }) +{{/hasProduces}} + public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException, ProcessingException; +{{/operation}} +} +{{/operations}} + diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_exception.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_exception.mustache new file mode 100644 index 00000000000..fc5c5e5000a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_exception.mustache @@ -0,0 +1,23 @@ +{{>licenseInfo}} +package {{apiPackage}}; + +import javax.ws.rs.core.Response; + +public class ApiException extends Exception { + + private static final long serialVersionUID = 1L; + private Response response; + + public ApiException() { + super(); + } + + public ApiException(Response response) { + super("Api response has status code " + response.getStatus()); + this.response = response; + } + + public Response getResponse() { + return this.response; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_exception_mapper.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_exception_mapper.mustache new file mode 100644 index 00000000000..9c5988414cd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_exception_mapper.mustache @@ -0,0 +1,22 @@ +{{>licenseInfo}} +package {{apiPackage}}; + +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; + +@Provider +public class ApiExceptionMapper + implements ResponseExceptionMapper { + + @Override + public boolean handles(int status, MultivaluedMap headers) { + return status >= 400; + } + + @Override + public ApiException toThrowable(Response response) { + return new ApiException(response); + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_test.mustache new file mode 100644 index 00000000000..8177ac16dad --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_test.mustache @@ -0,0 +1,75 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; + +import java.net.URL; +import java.net.MalformedURLException; +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + + + +/** + {{#appName}} + * {{{appName}}} Test + * + {{/appName}} + * API tests for {{classname}} + */ +{{#generateSpringBootApplication}} +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = SpringBootApplication.class) +@WebAppConfiguration +@IntegrationTest("server.port=0") +{{/generateSpringBootApplication}} +public class {{classname}}Test { + + private {{classname}} client; + private String baseUrl = "http://localhost:9080"; + + @Before + public void setup() throws MalformedURLException { + client = RestClientBuilder.newBuilder() + .baseUrl(new URL(baseUrl)) + .register(ApiException.class) + .build({{classname}}.class); + } + + {{#operations}}{{#operation}} + /** + {{#summary}} + * {{summary}} + * + {{#notes}} + * {{notes}} + * + {{/notes}} + {{/summary}} + * @throws ApiException + * if the Api call fails + */ + @Test + public void {{operationId}}Test() { + // TODO: test validations + {{#allParams}} + {{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}} + {{/allParams}} + //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + //{{#returnType}}assertNotNull(response);{{/returnType}} + + + } + {{/operation}}{{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidation.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidation.mustache new file mode 100644 index 00000000000..c8c6946fef6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidation.mustache @@ -0,0 +1,4 @@ +{{#required}} + @NotNull +{{/required}} +{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationCore.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationCore.mustache new file mode 100644 index 00000000000..8bcdce3df16 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationCore.mustache @@ -0,0 +1,20 @@ +{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! +minLength && maxLength set +}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! +minLength set, maxLength not +}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{! +minLength not set, maxLength set +}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{! +@Size: minItems && maxItems set +}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{! +@Size: minItems set, maxItems not +}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{! +@Size: minItems not set && maxItems set +}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{! +check for integer or long / all others=decimal type with @Decimal* +isInteger set +}}{{#isInteger}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isInteger}}{{! +isLong set +}}{{#isLong}}{{#minimum}} @Min({{minimum}}L){{/minimum}}{{#maximum}} @Max({{maximum}}L){{/maximum}}{{/isLong}}{{! +Not Integer, not Long => we have a decimal value! +}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationHeaderParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationHeaderParams.mustache new file mode 100644 index 00000000000..f8eef8f94c7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationHeaderParams.mustache @@ -0,0 +1 @@ +{{#required}} @NotNull{{/required}}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationPathParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationPathParams.mustache new file mode 100644 index 00000000000..051bd53c0a5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationPathParams.mustache @@ -0,0 +1 @@ +{{! PathParam is always required, no @NotNull necessary }}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationQueryParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationQueryParams.mustache new file mode 100644 index 00000000000..f8eef8f94c7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/beanValidationQueryParams.mustache @@ -0,0 +1 @@ +{{#required}} @NotNull{{/required}}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/bodyParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/bodyParams.mustache new file mode 100644 index 00000000000..be56da7535b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/bodyParams.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/bodyParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/bodyParamsImpl.mustache new file mode 100644 index 00000000000..c7d1abfe527 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/bodyParamsImpl.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumClass.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumClass.mustache new file mode 100644 index 00000000000..5bdcf238a2c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumClass.mustache @@ -0,0 +1,33 @@ +@XmlType(name="{{datatypeWithEnum}}") +@XmlEnum({{dataType}}.class) +public enum {{datatypeWithEnum}} { + + {{#allowableValues}} +{{#enumVars}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} + {{/allowableValues}} + + + private {{dataType}} value; + + {{datatypeWithEnum}} ({{dataType}} v) { + value = v; + } + + public {{dataType}} value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static {{datatypeWithEnum}} fromValue(String v) { + for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + v + "'");{{/useNullForUnknownEnumValue}} + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumOuterClass.mustache new file mode 100644 index 00000000000..df2c7287396 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumOuterClass.mustache @@ -0,0 +1,48 @@ +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +{{/jackson}} + +/** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + */ +public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { + {{#gson}} + {{#allowableValues}}{{#enumVars}} + @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/gson}} + {{^gson}} + {{#allowableValues}}{{#enumVars}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/gson}} + + private {{{dataType}}} value; + + {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + + @Override +{{#jackson}} + @JsonValue +{{/jackson}} + public String toString() { + return String.valueOf(value); + } + +{{#jackson}} + @JsonCreator +{{/jackson}} + public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) { + for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}} + } + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/formParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/formParams.mustache new file mode 100644 index 00000000000..97216dc1806 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/formParams.mustache @@ -0,0 +1 @@ +{{#isFormParam}}{{^isFile}}@Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/formParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/formParamsImpl.mustache new file mode 100644 index 00000000000..2be40e1ddd3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/formParamsImpl.mustache @@ -0,0 +1 @@ +{{#isFormParam}}{{^isFile}}{{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/generatedAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/generatedAnnotation.mustache new file mode 100644 index 00000000000..49110fc1ad9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/generatedAnnotation.mustache @@ -0,0 +1 @@ +@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/headerParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/headerParams.mustache new file mode 100644 index 00000000000..4a9009e76a2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/headerParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}@HeaderParam("{{baseName}}") {{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/headerParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/headerParamsImpl.mustache new file mode 100644 index 00000000000..bd03573d196 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/headerParamsImpl.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}{{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/licenseInfo.mustache new file mode 100644 index 00000000000..02acad802ec --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/licenseInfo.mustache @@ -0,0 +1,23 @@ +/** + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + * 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. + */ diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/model.mustache new file mode 100644 index 00000000000..5272ff09487 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/model.mustache @@ -0,0 +1,23 @@ +{{>licenseInfo}} +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#useBeanValidation}} +import javax.validation.constraints.*; +import javax.validation.Valid; +{{/useBeanValidation}} + +{{#models}} +{{#model}} +{{#isEnum}} +{{>enumOuterClass}} +{{/isEnum}} +{{^isEnum}} +{{>pojo}} +{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pathParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pathParams.mustache new file mode 100644 index 00000000000..9e8455d5ac7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pathParams.mustache @@ -0,0 +1 @@ +{{#isPathParam}}@PathParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pathParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pathParamsImpl.mustache new file mode 100644 index 00000000000..6829cf8c7a6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pathParamsImpl.mustache @@ -0,0 +1 @@ +{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache new file mode 100644 index 00000000000..a7d3ddb77c1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache @@ -0,0 +1,129 @@ +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.json.bind.annotation.JsonbProperty; + +{{#withXml}} +@XmlAccessorType(XmlAccessType.FIELD) +{{#hasVars}} @XmlType(name = "{{classname}}", propOrder = + { {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}} +}){{/hasVars}} +{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}} +{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}} +{{/withXml}} +{{#description}} +/** + * {{{description}}} + **/ +{{/description}} +public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} { + {{#vars}}{{#isEnum}}{{^isContainer}} +{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} +{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} +{{#withXml}} + @XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}}) +{{/withXml}} +{{#description}} + /** + * {{{description}}} + **/ +{{/description}} +{{#isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; +{{/isContainer}} +{{^isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; +{{/isContainer}} + {{/vars}} + + {{#vars}} + /** + {{#description}} + * {{description}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} + * @return {{name}} + **/ + @JsonbProperty("{{baseName}}") +{{#vendorExtensions.extraAnnotation}} + {{{vendorExtensions.extraAnnotation}}} +{{/vendorExtensions.extraAnnotation}} +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#isEnum}}{{^isListContainer}}{{^isMapContainer}}public {{dataType}} {{getter}}() { + if ({{name}} == null) { + return null; + } + return {{name}}.value(); + }{{/isMapContainer}}{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isListContainer}}public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + }{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isMapContainer}}public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + }{{/isMapContainer}}{{/isEnum}}{{^isEnum}}public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + }{{/isEnum}} + + {{^isReadOnly}} + /** + * Set {{name}} + **/ + public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + } + + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + return this; + } + {{#isListContainer}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + this.{{name}}.add({{name}}Item); + return this; + } + {{/isListContainer}} + {{#isMapContainer}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + this.{{name}}.put(key, {{name}}Item); + return this; + } + {{/isMapContainer}} + {{/isReadOnly}} + + {{/vars}} + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} + {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}}sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache new file mode 100644 index 00000000000..95ffef03353 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache @@ -0,0 +1,173 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + {{#appDescription}} + {{appDescription}} + {{/appDescription}} + {{artifactVersion}} + + src/main/java + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + junit + junit + ${junit-version} + test + +{{#useBeanValidation}} + + + javax.validation + validation-api + ${beanvalidation-version} + provided + +{{/useBeanValidation}} + + + org.eclipse.microprofile.rest.client + microprofile-rest-client-api + 1.2.1 + + + + + javax.ws.rs + javax.ws.rs-api + 2.1.1 + provided + + + + io.smallrye + smallrye-rest-client + 1.2.1 + test + + + + io.smallrye + smallrye-config + 1.3.5 + test + + + {{^disableMultipart}} + + org.apache.cxf + cxf-rt-rs-extension-providers + 3.2.6 + + {{/disableMultipart}} + + + javax.json.bind + javax.json.bind-api + 1.0 + + + javax.xml.bind + jaxb-api + 2.2.11 + + + com.sun.xml.bind + jaxb-core + 2.2.11 + + + com.sun.xml.bind + jaxb-impl + 2.2.11 + + + javax.activation + activation + 1.1.1 + + +{{#java8}} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-jaxrs-version} + +{{/java8}} +{{^java8}} + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-jaxrs-version} + +{{/java8}} +{{#useBeanValidationFeature}} + + org.hibernate + hibernate-validator + 5.2.2.Final + +{{/useBeanValidationFeature}} + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 1.8 + ${java.version} + ${java.version} + 1.5.18 + 9.2.9.v20150224 + 4.12 + 1.1.7 + 2.5 +{{#useBeanValidation}} + 1.1.0.Final +{{/useBeanValidation}} + 3.2.7 + 2.9.7 + UTF-8 + + diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/queryParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/queryParams.mustache new file mode 100644 index 00000000000..ca2c6e106f7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/queryParams.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}) {{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/queryParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/queryParamsImpl.mustache new file mode 100644 index 00000000000..ff79730471d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/queryParamsImpl.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/returnTypes.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/returnTypes.mustache new file mode 100644 index 00000000000..6af86ffe4e4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/returnTypes.mustache @@ -0,0 +1,4 @@ +{{#useGenericResponse}}Response{{/useGenericResponse}}{{! non-generic response: +}}{{^useGenericResponse}}{{! +}}{{{returnType}}}{{! +}}{{/useGenericResponse}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/gradle-wrapper.jar b/modules/openapi-generator/src/main/resources/Java/libraries/native/gradle-wrapper.jar deleted file mode 100644 index 5c2d1cf016b..00000000000 Binary files a/modules/openapi-generator/src/main/resources/Java/libraries/native/gradle-wrapper.jar and /dev/null differ diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/gradle-wrapper.properties.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/gradle-wrapper.properties.mustache deleted file mode 100644 index b0acbdcd73b..00000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/gradle-wrapper.properties.mustache +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/gradlew.bat.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/gradlew.bat.mustache deleted file mode 100644 index 9618d8d9607..00000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/gradlew.bat.mustache +++ /dev/null @@ -1,100 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@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="-Xmx64m" "-Xms64m" - -@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/src/main/resources/Java/libraries/native/gradlew.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/gradlew.mustache deleted file mode 100755 index 8e25e6c19d5..00000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/gradlew.mustache +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# 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 -# -# https://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. -# - -############################################################################## -## -## 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='"-Xmx64m" "-Xms64m"' - -# 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/src/main/resources/Java/libraries/rest-assured/Oper.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/Oper.mustache new file mode 100644 index 00000000000..b8684665b56 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/Oper.mustache @@ -0,0 +1,13 @@ +{{>licenseInfo}} + +package {{apiPackage}}; + +import io.restassured.response.Response; + +import java.util.function.Function; + +public interface Oper { + + T execute(Function handler); + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache index db803e8f2e1..2016726a9cb 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache @@ -56,6 +56,15 @@ public class {{classname}} { return reqSpec; } + public List getAllOperations() { + return Arrays.asList( +{{#operations}} +{{#operation}} + {{operationId}}(){{^-last}},{{/-last}} +{{/operation}} +{{/operations}} + ); + } {{#operations}} {{#operation}} @@ -107,7 +116,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public static class {{operationIdCamelCase}}Oper { + public static class {{operationIdCamelCase}}Oper implements Oper { public static final Method REQ_METHOD = {{httpMethod}}; public static final String REQ_URI = "{{path}}"; @@ -134,6 +143,7 @@ public class {{classname}} { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache index 013ab6dc0e5..e21f3847641 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache @@ -497,7 +497,7 @@ public class ApiClient { formParams .toSingleValueMap() .entrySet() - .forEach(es -> map.add(es.getKey(), (String) es.getValue())); + .forEach(es -> map.add(es.getKey(), String.valueOf(es.getValue()))); return BodyInserters.fromFormData(map); } else if(MediaType.MULTIPART_FORM_DATA.equals(contentType)) { @@ -638,6 +638,28 @@ public class ApiClient { } } + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param values The values of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(CollectionFormat collectionFormat, Collection values) { + // create the value based on the collection format + if (CollectionFormat.MULTI.equals(collectionFormat)) { + // not valid for path params + return parameterToString(values); + } + + // collectionFormat is assumed to be "csv" by default + if(collectionFormat == null) { + collectionFormat = CollectionFormat.CSV; + } + + return collectionFormat.collectionToString(values); + } + private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor { private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache index 96066577b0e..9138d7d2e7a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache @@ -70,7 +70,8 @@ public class {{classname}} { {{/required}}{{/allParams}} // create path and map variables final Map pathParams = new HashMap();{{#hasPathParams}}{{#pathParams}} - pathParams.put("{{baseName}}", {{{paramName}}});{{/pathParams}}{{/hasPathParams}} + pathParams.put("{{baseName}}", {{#collectionFormat}}apiClient.collectionPathParameterToString(ApiClient.CollectionFormat.valueOf("csv".toUpperCase()), {{/collectionFormat}}{{{paramName}}}{{#collectionFormat}}){{/collectionFormat}});{{/pathParams}}{{/hasPathParams}} + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache index 9814954cc4b..796f9a7ec14 100644 --- a/modules/openapi-generator/src/main/resources/Java/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pojo.mustache @@ -9,7 +9,7 @@ {{/vars}} }) {{/jackson}} -{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcelableModel}}implements Parcelable {{#serializableModel}}, Serializable {{/serializableModel}}{{/parcelableModel}}{{^parcelableModel}}{{#serializableModel}}implements Serializable {{/serializableModel}}{{/parcelableModel}}{ {{#serializableModel}} private static final long serialVersionUID = 1L; diff --git a/modules/openapi-generator/src/main/resources/JavaInflector/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaInflector/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaInflector/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaInflector/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaInflector/pojo.mustache index badfdbc35a3..34c34a0ec26 100644 --- a/modules/openapi-generator/src/main/resources/JavaInflector/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaInflector/pojo.mustache @@ -1,5 +1,5 @@ {{#description}}@ApiModel(description = "{{{description}}}"){{/description}} -{{>generatedAnnotation}} +{{>generatedAnnotation}}{{>additionalModelTypeAnnotations}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}} {{#isEnum}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/pojo.mustache index 8c5e307bdcd..6d50290d16e 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/pojo.mustache @@ -3,7 +3,7 @@ import java.util.Objects; import javax.xml.bind.annotation.*; -{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} +{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}{{>additionalModelTypeAnnotations}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}}{{^isContainer}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pojo.mustache index 402331f1fbf..bca023bfb80 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pojo.mustache @@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * {{{description}}} */ @ApiModel(description="{{{description}}}") -{{/description}} +{{/description}}{{>additionalModelTypeAnnotations}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}}{{^isContainer}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache index df02462ff23..df99f136dc2 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache @@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; **/ @ApiModel(description="{{{description}}}") {{/description}} -{{>xmlPojoAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} { +{{>additionalModelTypeAnnotations}}{{>xmlPojoAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}}{{^isContainer}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/pojo.mustache index 302b7e257c8..7dc314102f4 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/pojo.mustache @@ -9,7 +9,7 @@ {{/vars}} }) {{/jackson}} -{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}} {{#isEnum}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pojo.mustache index a3262bd41d5..9b66957fbf1 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pojo.mustache @@ -1,6 +1,6 @@ import io.swagger.annotations.*; -{{#description}}@ApiModel(description="{{{description}}}"){{/description}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} +{{#description}}@ApiModel(description="{{{description}}}"){{/description}}{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#serializableModel}} private static final long serialVersionUID = 1L; diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pojo.mustache index cbb6c907150..3e3815c4aeb 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pojo.mustache @@ -1,6 +1,6 @@ import io.swagger.annotations.*; -{{#description}}@ApiModel(description="{{{description}}}"){{/description}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} +{{#description}}@ApiModel(description="{{{description}}}"){{/description}}{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#serializableModel}} private static final long serialVersionUID = 1L; diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.native.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.native.mustache index 17f7a60973a..b1821fac4c5 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.native.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.native.mustache @@ -3,7 +3,7 @@ # # Before building the docker image run: # -# mvn package -Pnative -Dnative-image.docker-build=true +# mvn package -Pnative -Dquarkus.native.container-build=true # # Then, build the image with: # diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache index 4ea71205974..df616018ae0 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache @@ -7,21 +7,24 @@ {{artifactId}} {{artifactVersion}} - UTF-8 - 2.22.0 - true - 0.27.0 3.8.1 + true 1.8 - UTF-8 1.8 + UTF-8 + UTF-8 + 1.0.1.Final + quarkus-universe-bom + io.quarkus + 1.0.1.Final + 2.22.1 - io.quarkus - quarkus-bom - ${quarkus.version} + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} pom import @@ -71,7 +74,7 @@ io.quarkus quarkus-maven-plugin - ${quarkus.version} + ${quarkus-plugin.version} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache index aecf440129d..dc9bd039d02 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache @@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * {{description}} **/{{/description}}{{#useSwaggerAnnotations}} -{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}{{/useSwaggerAnnotations}} +{{#description}}{{>additionalModelTypeAnnotations}}@ApiModel(description = "{{{description}}}"){{/description}}{{/useSwaggerAnnotations}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}}{{^isContainer}} diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache index 164bbcea5d9..f047ee98336 100644 --- a/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache @@ -5,7 +5,7 @@ import javax.validation.constraints.*; /** * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} */ -{{>generatedAnnotation}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache index 7b3cc1f9465..4722038fcd3 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache @@ -84,6 +84,25 @@ public interface {{classname}} { {{/jdk8-default-interface}} {{#operation}} + /** + * {{httpMethod}} {{{path}}}{{#summary}} : {{.}}{{/summary}} + {{#notes}} + * {{.}} + {{/notes}} + * + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + {{/allParams}} + * @return {{#responses}}{{message}} (status code {{code}}){{#hasMore}} + * or {{/hasMore}}{{/responses}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ {{#virtualService}} @ApiVirtual {{/virtualService}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache index 5052f367a27..75892028502 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache @@ -89,6 +89,26 @@ public class {{classname}}Controller implements {{classname}} { {{^jdk8}} {{#operation}} + /** + * {{httpMethod}} {{{path}}}{{#summary}} : {{.}}{{/summary}} + {{#notes}} + * {{.}} + {{/notes}} + * + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + {{/allParams}} + * @return {{#responses}}{{message}} (status code {{code}}){{#hasMore}} + * or {{/hasMore}}{{/responses}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + * @see {{classname}}#{{operationId}} + */ public {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) { {{^isDelegate}} {{^async}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache index a055cb86d5a..e93ba0a69d3 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache @@ -48,9 +48,26 @@ public interface {{classname}}Delegate { {{#operation}} /** + * {{httpMethod}} {{{path}}}{{#summary}} : {{.}}{{/summary}} + {{#notes}} + * {{.}} + {{/notes}} + * + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + {{/allParams}} + * @return {{#responses}}{{message}} (status code {{code}}){{#hasMore}} + * or {{/hasMore}}{{/responses}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} * @see {{classname}}#{{operationId}} */ - {{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{{dataType}}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}MultipartFile{{/isFile}} {{paramName}}{{#hasMore}}, + {{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{{dataType}}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#isListContainer}}List<{{/isListContainer}}MultipartFile{{#isListContainer}}>{{/isListContainer}}{{/isFile}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}ServerWebExchange exchange{{/reactive}}){{#unhandledException}} throws Exception{{/unhandledException}}{{^jdk8-default-interface}};{{/jdk8-default-interface}}{{#jdk8-default-interface}} { {{>methodBody}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache index f007d68c3b4..14d94bfb312 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}@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}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "file detail") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}@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}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("{{baseName}}") {{#isListContainer}}List<{{/isListContainer}}MultipartFile{{#isListContainer}}>{{/isListContainer}} {{baseName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/formParams.mustache index 26a65bd2de5..13a6e56e14b 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "file detail") @RequestParam("{{baseName}}") MultipartFile {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") @RequestParam("{{baseName}}") {{#isListContainer}}List<{{/isListContainer}}MultipartFile{{#isListContainer}}>{{/isListContainer}} {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index 5ccc8a8c936..9c748649e5f 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -2,7 +2,7 @@ * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} */{{#description}} @ApiModel(description = "{{{description}}}"){{/description}} -{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}{{>additionalModelTypeAnnotations}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}{{#hateoas}}extends RepresentationModel<{{classname}}> {{/hateoas}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#serializableModel}} private static final long serialVersionUID = 1L; diff --git a/modules/openapi-generator/src/main/resources/JavaVertXServer/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaVertXServer/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaVertXServer/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaVertXServer/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaVertXServer/pojo.mustache index 014ba3e2b43..8a1d4180d44 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXServer/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXServer/pojo.mustache @@ -1,4 +1,4 @@ -@JsonInclude(JsonInclude.Include.NON_NULL) +{{>additionalModelTypeAnnotations}}@JsonInclude(JsonInclude.Include.NON_NULL) public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}}{{^isContainer}} diff --git a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/pojo.mustache index 014ba3e2b43..8a1d4180d44 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/pojo.mustache @@ -1,4 +1,4 @@ -@JsonInclude(JsonInclude.Include.NON_NULL) +{{>additionalModelTypeAnnotations}}@JsonInclude(JsonInclude.Include.NON_NULL) public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}}{{^isContainer}} diff --git a/modules/openapi-generator/src/main/resources/apex/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/apex/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/apex/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/apex/pojo.mustache b/modules/openapi-generator/src/main/resources/apex/pojo.mustache index 320b90922d8..9f192178eea 100644 --- a/modules/openapi-generator/src/main/resources/apex/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/apex/pojo.mustache @@ -1,6 +1,6 @@ /** * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} - */ + */{{>additionalModelTypeAnnotations}} public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{#interfaces}}{{#-first}} implements {{/-first}}{{^-first}}, {{/-first}}{{.}}{{/interfaces}} { {{#vars}} {{#isEnum}} diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-header.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-header.mustache index 3fc013a8b0c..4113a04e6b3 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-header.mustache @@ -24,6 +24,9 @@ struct {{classname}} {{^required}}Pistache::Optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{baseName}}; {{/vars}} + bool operator==(const {{classname}}& other) const; + bool operator!=(const {{classname}}& other) const; + nlohmann::json to_json() const; static {{classname}} from_json(const nlohmann::json& j); }; diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-source.mustache index 2e4f114cc73..b67e8aa366e 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-source.mustache @@ -21,6 +21,16 @@ nlohmann::json {{classname}}::to_json() const return o; } +bool {{classname}}::operator==(const {{classname}}& other) const +{ + return {{#vars}}{{baseName}} == other.{{baseName}}{{#hasMore}} && {{/hasMore}}{{/vars}}; +} + +bool {{classname}}::operator!=(const {{classname}}& other) const +{ + return !(*this == other); +} + void to_json(nlohmann::json& j, const {{classname}}& o) { {{#vars}} diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache index a4ff7f64c4a..ff515e56989 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache @@ -1,5 +1,4 @@ {{>licenseInfo}} - #include #include #include @@ -11,129 +10,117 @@ namespace {{this}} { {{/cppNamespaceDeclarations}} -void -{{prefix}}HttpFileElement::setMimeType(const QString &mime){ +void {{prefix}}HttpFileElement::setMimeType(const QString &mime) { mime_type = mime; } -void -{{prefix}}HttpFileElement::setFileName(const QString &name){ +void {{prefix}}HttpFileElement::setFileName(const QString &name) { local_filename = name; } -void -{{prefix}}HttpFileElement::setVariableName(const QString &name){ +void {{prefix}}HttpFileElement::setVariableName(const QString &name) { variable_name = name; } -void -{{prefix}}HttpFileElement::setRequestFileName(const QString &name){ +void {{prefix}}HttpFileElement::setRequestFileName(const QString &name) { request_filename = name; } -bool -{{prefix}}HttpFileElement::isSet() const { +bool {{prefix}}HttpFileElement::isSet() const { return !local_filename.isEmpty() || !request_filename.isEmpty(); } -QString -{{prefix}}HttpFileElement::asJson() const{ +QString {{prefix}}HttpFileElement::asJson() const { QFile file(local_filename); QByteArray bArray; bool result = false; - if(file.exists()) { + if (file.exists()) { result = file.open(QIODevice::ReadOnly); bArray = file.readAll(); file.close(); } - if(!result) { + if (!result) { qDebug() << "Error opening file " << local_filename; } return QString(bArray); } -QJsonValue -{{prefix}}HttpFileElement::asJsonValue() const{ +QJsonValue {{prefix}}HttpFileElement::asJsonValue() const { QFile file(local_filename); QByteArray bArray; - bool result = false; - if(file.exists()) { + bool result = false; + if (file.exists()) { result = file.open(QIODevice::ReadOnly); bArray = file.readAll(); file.close(); } - if(!result) { + if (!result) { qDebug() << "Error opening file " << local_filename; } return QJsonDocument::fromBinaryData(bArray.data()).object(); } -bool -{{prefix}}HttpFileElement::fromStringValue(const QString &instr){ +bool {{prefix}}HttpFileElement::fromStringValue(const QString &instr) { QFile file(local_filename); bool result = false; - if(file.exists()) { + if (file.exists()) { file.remove(); } result = file.open(QIODevice::WriteOnly); file.write(instr.toUtf8()); file.close(); - if(!result) { + if (!result) { qDebug() << "Error creating file " << local_filename; } return result; } -bool -{{prefix}}HttpFileElement::fromJsonValue(const QJsonValue &jval) { +bool {{prefix}}HttpFileElement::fromJsonValue(const QJsonValue &jval) { QFile file(local_filename); bool result = false; - if(file.exists()) { + if (file.exists()) { file.remove(); } result = file.open(QIODevice::WriteOnly); file.write(QJsonDocument(jval.toObject()).toBinaryData()); file.close(); - if(!result) { + if (!result) { qDebug() << "Error creating file " << local_filename; } return result; } -QByteArray -{{prefix}}HttpFileElement::asByteArray() const { +QByteArray {{prefix}}HttpFileElement::asByteArray() const { QFile file(local_filename); QByteArray bArray; bool result = false; - if(file.exists()) { + if (file.exists()) { result = file.open(QIODevice::ReadOnly); bArray = file.readAll(); file.close(); } - if(!result) { + if (!result) { qDebug() << "Error opening file " << local_filename; - } + } return bArray; } -bool -{{prefix}}HttpFileElement::fromByteArray(const QByteArray& bytes){ +bool {{prefix}}HttpFileElement::fromByteArray(const QByteArray &bytes) { QFile file(local_filename); bool result = false; - if(file.exists()){ + if (file.exists()) { file.remove(); } result = file.open(QIODevice::WriteOnly); file.write(bytes); file.close(); - if(!result) { + if (!result) { qDebug() << "Error creating file " << local_filename; } return result; } -bool -{{prefix}}HttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray& bytes){ +bool {{prefix}}HttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray &bytes) { setMimeType(mime); setFileName(localFName); setVariableName(varName); @@ -141,8 +128,7 @@ bool return fromByteArray(bytes); } -QByteArray -{{prefix}}HttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime){ +QByteArray {{prefix}}HttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime) { setMimeType(mime); setFileName(localFName); setVariableName(varName); @@ -151,5 +137,5 @@ QByteArray } {{#cppNamespaceDeclarations}} -} -{{/cppNamespaceDeclarations}} \ No newline at end of file +} // namespace {{this}} +{{/cppNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.h.mustache index 9ebfe362356..d09c4e57db8 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.h.mustache @@ -6,7 +6,6 @@ #include #include - {{#cppNamespaceDeclarations}} namespace {{this}} { {{/cppNamespaceDeclarations}} @@ -25,8 +24,8 @@ public: bool isSet() const; bool fromStringValue(const QString &instr); bool fromJsonValue(const QJsonValue &jval); - bool fromByteArray(const QByteArray& bytes); - bool saveToFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime, const QByteArray& bytes); + bool fromByteArray(const QByteArray &bytes); + bool saveToFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime, const QByteArray &bytes); QString asJson() const; QJsonValue asJsonValue() const; QByteArray asByteArray() const; @@ -34,7 +33,7 @@ public: }; {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{prefix}}HttpFileElement) 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 6670c2e0abf..a28bbad0018 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 @@ -1,18 +1,15 @@ {{>licenseInfo}} - - +#include #include #include -#include -#include #include -#include -#include #include +#include +#include +#include #include "{{prefix}}HttpRequest.h" - {{#cppNamespaceDeclarations}} namespace {{this}} { {{/cppNamespaceDeclarations}} @@ -46,61 +43,58 @@ void {{prefix}}HttpRequestInput::add_file(QString variable_name, QString local_f files.append(file); } - {{prefix}}HttpRequestWorker::{{prefix}}HttpRequestWorker(QObject *parent) - : QObject(parent), manager(nullptr), _timeOut(0) -{ + : QObject(parent), manager(nullptr), _timeOut(0) { qsrand(QDateTime::currentDateTime().toTime_t()); manager = new QNetworkAccessManager(this); - workingDirectory = QDir::currentPath(); + workingDirectory = QDir::currentPath(); connect(manager, &QNetworkAccessManager::finished, this, &{{prefix}}HttpRequestWorker::on_manager_finished); } {{prefix}}HttpRequestWorker::~{{prefix}}HttpRequestWorker() { - for (const auto & item: multiPartFields) { - if(item != nullptr) { + for (const auto &item : multiPartFields) { + if (item != nullptr) { delete item; } - } + } } QMap {{prefix}}HttpRequestWorker::getResponseHeaders() const { return headers; } -{{prefix}}HttpFileElement {{prefix}}HttpRequestWorker::getHttpFileElement(const QString &fieldname){ - if(!files.isEmpty()){ - if(fieldname.isEmpty()){ +{{prefix}}HttpFileElement {{prefix}}HttpRequestWorker::getHttpFileElement(const QString &fieldname) { + if (!files.isEmpty()) { + if (fieldname.isEmpty()) { return files.first(); - }else if (files.contains(fieldname)){ + } else if (files.contains(fieldname)) { return files[fieldname]; } } return {{prefix}}HttpFileElement(); } -QByteArray *{{prefix}}HttpRequestWorker::getMultiPartField(const QString &fieldname){ - if(!multiPartFields.isEmpty()){ - if(fieldname.isEmpty()){ +QByteArray *{{prefix}}HttpRequestWorker::getMultiPartField(const QString &fieldname) { + if (!multiPartFields.isEmpty()) { + if (fieldname.isEmpty()) { return multiPartFields.first(); - }else if (multiPartFields.contains(fieldname)){ + } else if (multiPartFields.contains(fieldname)) { return multiPartFields[fieldname]; } } return nullptr; } -void {{prefix}}HttpRequestWorker::setTimeOut(int timeOut){ +void {{prefix}}HttpRequestWorker::setTimeOut(int timeOut) { _timeOut = timeOut; } -void {{prefix}}HttpRequestWorker::setWorkingDirectory(const QString &path){ - if(!path.isEmpty()){ +void {{prefix}}HttpRequestWorker::setWorkingDirectory(const QString &path) { + if (!path.isEmpty()) { workingDirectory = path; } } - QString {{prefix}}HttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { // result structure follows RFC 5987 bool need_utf_encoding = false; @@ -112,11 +106,9 @@ QString {{prefix}}HttpRequestWorker::http_attribute_encode(QString attribute_nam if (c == '\\' || c == '/' || c == '\0' || c < ' ' || c > '~') { // ignore and request utf-8 version need_utf_encoding = true; - } - else if (c == '"') { + } else if (c == '"') { result += "\\\""; - } - else { + } else { result += c; } } @@ -133,14 +125,9 @@ QString {{prefix}}HttpRequestWorker::http_attribute_encode(QString attribute_nam QString result_utf8 = ""; for (int i = 0; i < input_c.length(); i++) { c = input_c.at(i); - if ( - (c >= '0' && c <= '9') - || (c >= 'A' && c <= 'Z') - || (c >= 'a' && c <= 'z') - ) { + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { result_utf8 += c; - } - else { + } else { result_utf8 += "%" + QString::number(static_cast(input_c.at(i)), 16).toUpper(); } } @@ -152,14 +139,13 @@ QString {{prefix}}HttpRequestWorker::http_attribute_encode(QString attribute_nam void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { // reset variables - QNetworkReply* reply = nullptr; + QNetworkReply *reply = nullptr; QByteArray request_content = ""; response = ""; error_type = QNetworkReply::NoError; error_str = ""; bool isFormData = false; - // decide on the variable layout if (input->files.length() > 0) { @@ -169,7 +155,6 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { input->var_layout = input->http_method == "GET" || input->http_method == "HEAD" ? ADDRESS : URL_ENCODED; } - // prepare request content QString boundary = ""; @@ -196,13 +181,12 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { request_content = ""; } } - } - else { + } else { // variable layout is MULTIPART - boundary = "__-----------------------" - + QString::number(QDateTime::currentDateTime().toTime_t()) - + QString::number(qrand()); + boundary = QString("__-----------------------%1%2") + .arg(QDateTime::currentDateTime().toTime_t()) + .arg(qrand()); QString boundary_delimiter = "--"; QString new_line = "\r\n"; @@ -233,11 +217,13 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { QFileInfo fi(file_info->local_filename); // ensure necessary variables are available - if ( - file_info->local_filename == nullptr || file_info->local_filename.isEmpty() - || file_info->variable_name == nullptr || file_info->variable_name.isEmpty() - || !fi.exists() || !fi.isFile() || !fi.isReadable() - ) { + if (file_info->local_filename == nullptr + || file_info->local_filename.isEmpty() + || file_info->variable_name == nullptr + || file_info->variable_name.isEmpty() + || !fi.exists() + || !fi.isFile() + || !fi.isReadable()) { // silent abort for the current file continue; } @@ -262,10 +248,8 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { request_content.append(new_line); // add header - request_content.append(QString("Content-Disposition: form-data; %1; %2").arg( - http_attribute_encode("name", file_info->variable_name), - http_attribute_encode("filename", file_info->request_filename) - )); + request_content.append( + QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename))); request_content.append(new_line); if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { @@ -293,7 +277,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { request_content.append(boundary_delimiter); } - if(input->request_body.size() > 0) { + if (input->request_body.size() > 0) { qDebug() << "got a request body"; request_content.clear(); request_content.append(input->request_body); @@ -305,41 +289,31 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { request.setSslConfiguration(*{{prefix}}HttpRequestWorker::sslDefaultConfiguration); } request.setRawHeader("User-Agent", "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{apiVersion}}/cpp-qt5{{/httpUserAgent}}"); - foreach(QString key, input->headers.keys()) { - request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); - } + foreach (QString key, input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); } if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) { - if(!input->headers.contains("Content-Type")){ + if (!input->headers.contains("Content-Type")) { request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); - } - else { + } else { request.setHeader(QNetworkRequest::ContentTypeHeader, input->headers.value("Content-Type")); } - } - else if (input->var_layout == URL_ENCODED) { + } else if (input->var_layout == URL_ENCODED) { request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - } - else if (input->var_layout == MULTIPART) { + } else if (input->var_layout == MULTIPART) { request.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=" + boundary); } if (input->http_method == "GET") { reply = manager->get(request); - } - else if (input->http_method == "POST") { + } else if (input->http_method == "POST") { reply = manager->post(request, request_content); - } - else if (input->http_method == "PUT") { + } else if (input->http_method == "PUT") { reply = manager->put(request, request_content); - } - else if (input->http_method == "HEAD") { + } else if (input->http_method == "HEAD") { reply = manager->head(request); - } - else if (input->http_method == "DELETE") { + } else if (input->http_method == "DELETE") { reply = manager->deleteResource(request); - } - else { + } else { #if (QT_VERSION >= 0x050800) manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); #else @@ -351,8 +325,8 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { buffer->setParent(reply); #endif } - if(_timeOut > 0){ - QTimer::singleShot(_timeOut, [=](){ on_manager_timeout(reply); }); + if (_timeOut > 0) { + QTimer::singleShot(_timeOut, [=]() { on_manager_timeout(reply); }); } } @@ -360,8 +334,8 @@ void {{prefix}}HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { error_type = reply->error(); response = reply->readAll(); error_str = reply->errorString(); - if(reply->rawHeaderPairs().count() > 0){ - for(const auto& item: reply->rawHeaderPairs()){ + if (reply->rawHeaderPairs().count() > 0) { + for (const auto &item : reply->rawHeaderPairs()) { headers.insert(item.first, item.second); } } @@ -381,36 +355,33 @@ void {{prefix}}HttpRequestWorker::on_manager_timeout(QNetworkReply *reply) { } void {{prefix}}HttpRequestWorker::process_form_response() { - if(getResponseHeaders().contains(QString("Content-Disposition")) ) { + if (getResponseHeaders().contains(QString("Content-Disposition"))) { auto contentDisposition = getResponseHeaders().value(QString("Content-Disposition").toUtf8()).split(QString(";"), QString::SkipEmptyParts); - auto contentType = getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts).first() : QString(); - if((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))){ + auto contentType = + getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts).first() : QString(); + if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { QString filename = QUuid::createUuid().toString(); - for(const auto &file : contentDisposition){ - if(file.contains(QString("filename"))){ + for (const auto &file : contentDisposition) { + if (file.contains(QString("filename"))) { filename = file.split(QString("="), QString::SkipEmptyParts).at(1); break; } } {{prefix}}HttpFileElement felement; felement.saveToFile(QString(), workingDirectory + QDir::separator() + filename, filename, contentType, response.data()); - files.insert(filename, felement); + files.insert(filename, felement); } - } else if(getResponseHeaders().contains(QString("Content-Type")) ) { + } else if (getResponseHeaders().contains(QString("Content-Type"))) { auto contentType = getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts); - if((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))){ - - } - else { - + if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { + } else { } } } -QSslConfiguration* {{prefix}}HttpRequestWorker::sslDefaultConfiguration; - +QSslConfiguration *{{prefix}}HttpRequestWorker::sslDefaultConfiguration; {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} 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 435d43d20ca..32ee8a2145d 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 @@ -8,11 +8,11 @@ #ifndef {{prefix}}_HTTPREQUESTWORKER_H #define {{prefix}}_HTTPREQUESTWORKER_H -#include -#include #include #include #include +#include +#include #include "{{prefix}}HttpFileElement.h" @@ -20,8 +20,12 @@ namespace {{this}} { {{/cppNamespaceDeclarations}} -enum {{prefix}}HttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART}; - +enum {{prefix}}HttpRequestVarLayout { + NOT_SET, + ADDRESS, + URL_ENCODED, + MULTIPART +}; class {{prefix}}HttpRequestInput { @@ -39,10 +43,8 @@ public: void initialize(); void add_var(QString key, QString value); void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type); - }; - class {{prefix}}HttpRequestWorker : public QObject { Q_OBJECT @@ -56,11 +58,11 @@ public: QMap getResponseHeaders() const; QString http_attribute_encode(QString attribute_name, QString input); void execute({{prefix}}HttpRequestInput *input); - static QSslConfiguration* sslDefaultConfiguration; + static QSslConfiguration *sslDefaultConfiguration; void setTimeOut(int tout); void setWorkingDirectory(const QString &path); {{prefix}}HttpFileElement getHttpFileElement(const QString &fieldname = QString()); - QByteArray* getMultiPartField(const QString &fieldname = QString()); + QByteArray *getMultiPartField(const QString &fieldname = QString()); signals: void on_execution_finished({{prefix}}HttpRequestWorker *worker); @@ -68,17 +70,17 @@ private: QNetworkAccessManager *manager; QMap headers; QMap files; - QMap multiPartFields; + QMap multiPartFields; QString workingDirectory; int _timeOut; void on_manager_timeout(QNetworkReply *reply); - void process_form_response(); + void process_form_response(); private slots: void on_manager_finished(QNetworkReply *reply); }; {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} #endif // {{prefix}}_HTTPREQUESTWORKER_H 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 a4d19e34626..7f24ba64a82 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 @@ -9,166 +9,150 @@ namespace {{this}} { {{/cppNamespaceDeclarations}} -{{classname}}::{{classname}}(const QString &scheme, const QString &host, int port, const QString& basePath, const int timeOut) : - _scheme(scheme), - _host(host), - _port(port), - _basePath(basePath), - _timeOut(timeOut) { -} +{{classname}}::{{classname}}(const QString &scheme, const QString &host, int port, const QString &basePath, const int timeOut) + : _scheme(scheme), + _host(host), + _port(port), + _basePath(basePath), + _timeOut(timeOut) {} {{classname}}::~{{classname}}() { } -void {{classname}}::setScheme(const QString& scheme){ +void {{classname}}::setScheme(const QString &scheme) { _scheme = scheme; } -void {{classname}}::setHost(const QString& host){ +void {{classname}}::setHost(const QString &host) { _host = host; } -void {{classname}}::setPort(int port){ +void {{classname}}::setPort(int port) { _port = port; } -void {{classname}}::setBasePath(const QString& basePath){ +void {{classname}}::setBasePath(const QString &basePath) { _basePath = basePath; } -void {{classname}}::setTimeOut(const int timeOut){ +void {{classname}}::setTimeOut(const int timeOut) { _timeOut = timeOut; } -void {{classname}}::setWorkingDirectory(const QString& path){ +void {{classname}}::setWorkingDirectory(const QString &path) { _workingDirectory = path; } -void {{classname}}::addHeaders(const QString& key, const QString& value){ +void {{classname}}::addHeaders(const QString &key, const QString &value) { defaultHeaders.insert(key, value); } {{#operations}} {{#operation}} -void -{{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}}& {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("{{{path}}}"); +void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("{{{path}}}"); {{#pathParams}} QString {{paramName}}PathParam("{"); {{paramName}}PathParam.append("{{baseName}}").append("}"); fullPath.replace({{paramName}}PathParam, QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}))); - {{/pathParams}} - {{#queryParams}}{{^collectionFormat}} +{{/pathParams}} +{{#queryParams}}{{^collectionFormat}} if (fullPath.indexOf("?") > 0) - fullPath.append("&"); + fullPath.append("&"); else - fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("{{baseName}}")) - .append("=") - .append(QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}))); - {{/collectionFormat}}{{#collectionFormat}} + fullPath.append("?"); + fullPath.append(QUrl::toPercentEncoding("{{baseName}}")).append("=").append(QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}))); +{{/collectionFormat}}{{#collectionFormat}} if ({{{paramName}}}.size() > 0) { - if (QString("{{collectionFormat}}").indexOf("multi") == 0) { - foreach({{{baseType}}} t, {{paramName}}) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("{{{baseName}}}=").append(::{{cppNamespace}}::toStringValue(t)); + if (QString("{{collectionFormat}}").indexOf("multi") == 0) { + foreach ({{{baseType}}} t, {{paramName}}) { + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append("{{{baseName}}}=").append(::{{cppNamespace}}::toStringValue(t)); + } + } else if (QString("{{collectionFormat}}").indexOf("ssv") == 0) { + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append("{{baseName}}="); + qint32 count = 0; + foreach ({{{baseType}}} t, {{paramName}}) { + if (count > 0) { + fullPath.append(" "); + } + fullPath.append(::{{cppNamespace}}::toStringValue(t)); + } + } else if (QString("{{collectionFormat}}").indexOf("tsv") == 0) { + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append("{{baseName}}="); + qint32 count = 0; + foreach ({{{baseType}}} t, {{paramName}}) { + if (count > 0) { + fullPath.append("\t"); + } + fullPath.append(::{{cppNamespace}}::toStringValue(t)); + } } - } - else if (QString("{{collectionFormat}}").indexOf("ssv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("{{baseName}}="); - qint32 count = 0; - foreach({{{baseType}}} t, {{paramName}}) { - if (count > 0) { - fullPath.append(" "); - } - fullPath.append(::{{cppNamespace}}::toStringValue(t)); - } - } - else if (QString("{{collectionFormat}}").indexOf("tsv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("{{baseName}}="); - qint32 count = 0; - foreach({{{baseType}}} t, {{paramName}}) { - if (count > 0) { - fullPath.append("\t"); - } - fullPath.append(::{{cppNamespace}}::toStringValue(t)); - } - } } - {{/collectionFormat}}{{/queryParams}} +{{/collectionFormat}}{{/queryParams}} {{prefix}}HttpRequestWorker *worker = new {{prefix}}HttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); {{prefix}}HttpRequestInput input(fullPath, "{{httpMethod}}"); - {{#formParams}}{{^isFile}} +{{#formParams}}{{^isFile}} input.add_var("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}));{{/isFile}}{{#isFile}} - input.add_file("{{baseName}}", {{paramName}}.local_filename, {{paramName}}.request_filename, {{paramName}}.mime_type);{{/isFile}}{{/formParams}} - {{#bodyParams}} - {{#isContainer}}{{#isListContainer}} + input.add_file("{{baseName}}", {{paramName}}.local_filename, {{paramName}}.request_filename, {{paramName}}.mime_type);{{/isFile}}{{/formParams}}{{#bodyParams}}{{#isContainer}}{{#isListContainer}} QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}).toArray());{{/isListContainer}}{{#isMapContainer}} QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}).toObject());{{/isMapContainer}} QByteArray bytes = doc.toJson(); input.request_body.append(bytes); - {{/isContainer}}{{^isContainer}}{{#isString}} +{{/isContainer}}{{^isContainer}}{{#isString}} QString output({{paramName}});{{/isString}}{{#isByteArray}}QString output({{paramName}});{{/isByteArray}}{{^isString}}{{^isByteArray}}{{^isFile}} QString output = {{paramName}}.asJson();{{/isFile}}{{/isByteArray}}{{/isString}}{{#isFile}}{{#hasConsumes}}input.headers.insert("Content-Type", {{#consumes}}{{^-first}}, {{/-first}}"{{mediaType}}"{{/consumes}});{{/hasConsumes}} QByteArray output = {{paramName}}.asByteArray();{{/isFile}} input.request_body.append(output); - {{/isContainer}}{{/bodyParams}} - {{#headerParams}} +{{/isContainer}}{{/bodyParams}}{{#headerParams}} if ({{paramName}} != nullptr) { input.headers.insert("{{baseName}}", {{paramName}}); } - {{/headerParams}} +{{/headerParams}} - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - connect(worker, - &{{prefix}}HttpRequestWorker::on_execution_finished, - this, - &{{classname}}::{{nickname}}Callback); + connect(worker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback); worker->execute(&input); } -void -{{classname}}::{{nickname}}Callback({{prefix}}HttpRequestWorker * worker) { +void {{classname}}::{{nickname}}Callback({{prefix}}HttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } {{#returnType}} {{#isListContainer}} {{{returnType}}} output; QString json(worker->response); - QByteArray array (json.toStdString().c_str()); + QByteArray array(json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonArray jsonArray = doc.array(); - foreach(QJsonValue obj, jsonArray) { + foreach (QJsonValue obj, jsonArray) { {{{returnBaseType}}} val; ::{{cppNamespace}}::fromJsonValue(val, obj); output.append(val); @@ -184,10 +168,10 @@ void {{#isMapContainer}} {{{returnType}}} output; QString json(worker->response); - QByteArray array (json.toStdString().c_str()); + QByteArray array(json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject obj = doc.object(); - foreach(QString key, obj.keys()) { + foreach (QString key, obj.keys()) { {{returnBaseType}} val; ::{{cppNamespace}}::fromJsonValue(val, obj[key]); output.insert(key, val); @@ -213,7 +197,6 @@ void {{/operation}} {{/operations}} - {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} 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 93538e92968..8c877912e17 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 @@ -13,23 +13,23 @@ namespace {{this}} { {{/cppNamespaceDeclarations}} -class {{classname}}: public QObject { +class {{classname}} : public QObject { Q_OBJECT public: - {{classname}}(const QString &scheme = "{{scheme}}", const QString &host = "{{serverHost}}", int port = {{#serverPort}}{{serverPort}}{{/serverPort}}{{^serverPort}}0{{/serverPort}}, const QString& basePath = "{{basePathWithoutHost}}", const int timeOut = 0); + {{classname}}(const QString &scheme = "{{scheme}}", const QString &host = "{{serverHost}}", int port = {{#serverPort}}{{serverPort}}{{/serverPort}}{{^serverPort}}0{{/serverPort}}, const QString &basePath = "{{basePathWithoutHost}}", const int timeOut = 0); ~{{classname}}(); void setScheme(const QString &scheme); void setHost(const QString &host); void setPort(int port); - void setBasePath(const QString& basePath); + void setBasePath(const QString &basePath); void setTimeOut(const int timeOut); - void setWorkingDirectory(const QString& path); - void addHeaders(const QString& key, const QString& value); + void setWorkingDirectory(const QString &path); + void addHeaders(const QString &key, const QString &value); +{{#operations}}{{#operation}} + void {{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/operation}}{{/operations}} - {{#operations}}{{#operation}}void {{nickname}}({{#allParams}}const {{{dataType}}}& {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - {{/operation}}{{/operations}} private: QString _scheme, _host; int _port; @@ -37,20 +37,21 @@ private: int _timeOut; QString _workingDirectory; QMap defaultHeaders; - {{#operations}}{{#operation}}void {{nickname}}Callback ({{prefix}}HttpRequestWorker * worker); - {{/operation}}{{/operations}} +{{#operations}}{{#operation}} + void {{nickname}}Callback({{prefix}}HttpRequestWorker *worker);{{/operation}}{{/operations}} + signals: - {{#operations}}{{#operation}}void {{nickname}}Signal({{#returnType}}{{{returnType}}} summary{{/returnType}}); - {{/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); - {{/operation}}{{/operations}} - {{#operations}}{{#operation}}void {{nickname}}SignalEFull({{prefix}}HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - {{/operation}}{{/operations}} +{{#operations}}{{#operation}} + void {{nickname}}Signal({{#returnType}}{{{returnType}}} summary{{/returnType}});{{/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);{{/operation}}{{/operations}} +{{#operations}}{{#operation}} + void {{nickname}}SignalEFull({{prefix}}HttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str);{{/operation}}{{/operations}} }; {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} #endif 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 bf34a3a150c..7a613a5947d 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 @@ -2,27 +2,23 @@ #ifndef {{prefix}}_ENUM_H #define {{prefix}}_ENUM_H -#include #include #include +#include {{#cppNamespaceDeclarations}} namespace {{this}} { {{/cppNamespaceDeclarations}} class {{prefix}}Enum { - public: - {{prefix}}Enum() { - - } +public: + {{prefix}}Enum() {} {{prefix}}Enum(QString jsonString) { fromJson(jsonString); } - virtual ~{{prefix}}Enum(){ - - } + virtual ~{{prefix}}Enum() {} virtual QJsonValue asJsonValue() const { return QJsonValue(jstr); @@ -47,12 +43,13 @@ class {{prefix}}Enum { virtual bool isValid() const { return true; } -private : + +private: QString jstr; }; {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{prefix}}Enum) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-body.mustache index b6a8ee4b2dc..29918951019 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-body.mustache @@ -1,246 +1,200 @@ {{>licenseInfo}} -#include #include "{{prefix}}Helpers.h" - +#include {{#cppNamespaceDeclarations}} namespace {{this}} { {{/cppNamespaceDeclarations}} - -QString -toStringValue(const QString &value) { +QString toStringValue(const QString &value) { return value; } -QString -toStringValue(const QDateTime &value){ +QString toStringValue(const QDateTime &value) { // ISO 8601 return value.toString("yyyy-MM-ddTHH:mm:ss[Z|[+|-]HH:mm]"); } -QString -toStringValue(const QByteArray &value){ +QString toStringValue(const QByteArray &value) { return QString(value); } -QString -toStringValue(const QDate &value){ +QString toStringValue(const QDate &value) { // ISO 8601 return value.toString(Qt::DateFormat::ISODate); } -QString -toStringValue(const qint32 &value) { +QString toStringValue(const qint32 &value) { return QString::number(value); } -QString -toStringValue(const qint64 &value) { +QString toStringValue(const qint64 &value) { return QString::number(value); } -QString -toStringValue(const bool &value) { +QString toStringValue(const bool &value) { return QString(value ? "true" : "false"); } -QString -toStringValue(const float &value){ +QString toStringValue(const float &value) { return QString::number(static_cast(value)); } -QString -toStringValue(const double &value){ +QString toStringValue(const double &value) { return QString::number(value); } -QString -toStringValue(const {{prefix}}Object &value){ +QString toStringValue(const {{prefix}}Object &value) { return value.asJson(); } - -QString -toStringValue(const {{prefix}}Enum &value){ +QString toStringValue(const {{prefix}}Enum &value) { return value.asJson(); } -QString -toStringValue(const {{prefix}}HttpFileElement &value){ +QString toStringValue(const {{prefix}}HttpFileElement &value) { return value.asJson(); } - -QJsonValue -toJsonValue(const QString &value){ - return QJsonValue(value); +QJsonValue toJsonValue(const QString &value) { + return QJsonValue(value); } -QJsonValue -toJsonValue(const QDateTime &value){ +QJsonValue toJsonValue(const QDateTime &value) { return QJsonValue(value.toString(Qt::ISODate)); } -QJsonValue -toJsonValue(const QByteArray &value){ +QJsonValue toJsonValue(const QByteArray &value) { return QJsonValue(QString(value.toBase64())); } -QJsonValue -toJsonValue(const QDate &value){ +QJsonValue toJsonValue(const QDate &value) { return QJsonValue(value.toString(Qt::ISODate)); } -QJsonValue -toJsonValue(const qint32 &value){ +QJsonValue toJsonValue(const qint32 &value) { return QJsonValue(value); } -QJsonValue -toJsonValue(const qint64 &value){ +QJsonValue toJsonValue(const qint64 &value) { return QJsonValue(value); } -QJsonValue -toJsonValue(const bool &value){ +QJsonValue toJsonValue(const bool &value) { return QJsonValue(value); } -QJsonValue -toJsonValue(const float &value){ +QJsonValue toJsonValue(const float &value) { return QJsonValue(static_cast(value)); } -QJsonValue -toJsonValue(const double &value){ +QJsonValue toJsonValue(const double &value) { return QJsonValue(value); } -QJsonValue -toJsonValue(const {{prefix}}Object &value){ +QJsonValue toJsonValue(const {{prefix}}Object &value) { return value.asJsonObject(); } -QJsonValue -toJsonValue(const {{prefix}}Enum &value){ +QJsonValue toJsonValue(const {{prefix}}Enum &value) { return value.asJsonValue(); } -QJsonValue -toJsonValue(const {{prefix}}HttpFileElement &value){ +QJsonValue toJsonValue(const {{prefix}}HttpFileElement &value) { return value.asJsonValue(); } - -bool -fromStringValue(const QString &inStr, QString &value){ +bool fromStringValue(const QString &inStr, QString &value) { value.clear(); value.append(inStr); return !inStr.isEmpty(); } -bool -fromStringValue(const QString &inStr, QDateTime &value){ - if(inStr.isEmpty()){ +bool fromStringValue(const QString &inStr, QDateTime &value) { + if (inStr.isEmpty()) { return false; - } - else{ + } else { auto dateTime = QDateTime::fromString(inStr, "yyyy-MM-ddTHH:mm:ss[Z|[+|-]HH:mm]"); - if(dateTime.isValid()){ + if (dateTime.isValid()) { value.setDate(dateTime.date()); value.setTime(dateTime.time()); - } - else{ + } else { qDebug() << "DateTime is invalid"; } return dateTime.isValid(); } } -bool -fromStringValue(const QString &inStr, QByteArray &value){ - if(inStr.isEmpty()){ +bool fromStringValue(const QString &inStr, QByteArray &value) { + if (inStr.isEmpty()) { return false; - } - else{ + } else { value.clear(); value.append(inStr.toUtf8()); return value.count() > 0; } } -bool -fromStringValue(const QString &inStr, QDate &value){ - if(inStr.isEmpty()){ +bool fromStringValue(const QString &inStr, QDate &value) { + if (inStr.isEmpty()) { return false; - } - else{ + } else { auto date = QDate::fromString(inStr, Qt::DateFormat::ISODate); - if(date.isValid()){ + if (date.isValid()) { value.setDate(date.year(), date.month(), date.day()); - } - else{ + } else { qDebug() << "Date is invalid"; } return date.isValid(); } } -bool -fromStringValue(const QString &inStr, qint32 &value){ +bool fromStringValue(const QString &inStr, qint32 &value) { bool ok = false; value = QVariant(inStr).toInt(&ok); return ok; } -bool -fromStringValue(const QString &inStr, qint64 &value){ +bool fromStringValue(const QString &inStr, qint64 &value) { bool ok = false; value = QVariant(inStr).toLongLong(&ok); return ok; } -bool -fromStringValue(const QString &inStr, bool &value){ +bool fromStringValue(const QString &inStr, bool &value) { value = QVariant(inStr).toBool(); return ((inStr == "true") || (inStr == "false")); } -bool -fromStringValue(const QString &inStr, float &value){ +bool fromStringValue(const QString &inStr, float &value) { bool ok = false; value = QVariant(inStr).toFloat(&ok); return ok; } -bool -fromStringValue(const QString &inStr, double &value){ +bool fromStringValue(const QString &inStr, double &value) { bool ok = false; value = QVariant(inStr).toDouble(&ok); return ok; } -bool -fromStringValue(const QString &inStr, {{prefix}}Enum &value){ +bool fromStringValue(const QString &inStr, {{prefix}}Enum &value) { value.fromJson(inStr); return true; } -bool -fromStringValue(const QString &inStr, {{prefix}}HttpFileElement &value){ +bool fromStringValue(const QString &inStr, {{prefix}}HttpFileElement &value) { return value.fromStringValue(inStr); } -bool -fromJsonValue(QString &value, const QJsonValue &jval){ +bool fromJsonValue(QString &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull()){ - if(jval.isString()){ + if (!jval.isUndefined() && !jval.isNull()) { + if (jval.isString()) { value = jval.toString(); - } else if(jval.isBool()) { - value = jval.toBool() ? "true" : "false"; - } else if(jval.isDouble()){ + } else if (jval.isBool()) { + value = jval.toBool() ? "true" : "false"; + } else if (jval.isDouble()) { value = QString::number(jval.toDouble()); } else { ok = false; @@ -251,10 +205,9 @@ fromJsonValue(QString &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(QDateTime &value, const QJsonValue &jval){ +bool fromJsonValue(QDateTime &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && jval.isString()){ + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { value = QDateTime::fromString(jval.toString(), Qt::ISODate); ok = value.isValid(); } else { @@ -263,22 +216,20 @@ fromJsonValue(QDateTime &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(QByteArray &value, const QJsonValue &jval){ +bool fromJsonValue(QByteArray &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && jval.isString()) { + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { value = QByteArray::fromBase64(QByteArray::fromStdString(jval.toString().toStdString())); - ok = value.size() > 0 ; + ok = value.size() > 0; } else { ok = false; } return ok; } -bool -fromJsonValue(QDate &value, const QJsonValue &jval){ +bool fromJsonValue(QDate &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && jval.isString()){ + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { value = QDate::fromString(jval.toString(), Qt::ISODate); ok = value.isValid(); } else { @@ -287,10 +238,9 @@ fromJsonValue(QDate &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(qint32 &value, const QJsonValue &jval){ +bool fromJsonValue(qint32 &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()){ + if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { value = jval.toInt(); } else { ok = false; @@ -298,10 +248,9 @@ fromJsonValue(qint32 &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(qint64 &value, const QJsonValue &jval){ +bool fromJsonValue(qint64 &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()){ + if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { value = jval.toVariant().toLongLong(); } else { ok = false; @@ -309,10 +258,9 @@ fromJsonValue(qint64 &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(bool &value, const QJsonValue &jval){ +bool fromJsonValue(bool &value, const QJsonValue &jval) { bool ok = true; - if(jval.isBool()){ + if (jval.isBool()) { value = jval.toBool(); } else { ok = false; @@ -320,10 +268,9 @@ fromJsonValue(bool &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(float &value, const QJsonValue &jval){ +bool fromJsonValue(float &value, const QJsonValue &jval) { bool ok = true; - if(jval.isDouble()){ + if (jval.isDouble()) { value = static_cast(jval.toDouble()); } else { ok = false; @@ -331,10 +278,9 @@ fromJsonValue(float &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(double &value, const QJsonValue &jval){ +bool fromJsonValue(double &value, const QJsonValue &jval) { bool ok = true; - if(jval.isDouble()){ + if (jval.isDouble()) { value = jval.toDouble(); } else { ok = false; @@ -342,10 +288,9 @@ fromJsonValue(double &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue({{prefix}}Object &value, const QJsonValue &jval){ +bool fromJsonValue({{prefix}}Object &value, const QJsonValue &jval) { bool ok = true; - if(jval.isObject()){ + if (jval.isObject()) { value.fromJsonObject(jval.toObject()); ok = value.isValid(); } else { @@ -354,17 +299,15 @@ fromJsonValue({{prefix}}Object &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue({{prefix}}Enum &value, const QJsonValue &jval){ +bool fromJsonValue({{prefix}}Enum &value, const QJsonValue &jval) { value.fromJsonValue(jval); return true; } -bool -fromJsonValue({{prefix}}HttpFileElement &value, const QJsonValue &jval){ +bool fromJsonValue({{prefix}}HttpFileElement &value, const QJsonValue &jval) { return value.fromJsonValue(jval); } {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-header.mustache index d68d1d23a89..a53e0a30edd 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-header.mustache @@ -2,184 +2,184 @@ #ifndef {{prefix}}_HELPERS_H #define {{prefix}}_HELPERS_H -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include #include -#include "{{prefix}}Object.h" #include "{{prefix}}Enum.h" #include "{{prefix}}HttpFileElement.h" +#include "{{prefix}}Object.h" {{#cppNamespaceDeclarations}} namespace {{this}} { {{/cppNamespaceDeclarations}} - template QString - toStringValue(const QList &val); +template +QString toStringValue(const QList &val); - template - bool fromStringValue(const QList &inStr, QList &val); +template +bool fromStringValue(const QList &inStr, QList &val); - template - bool fromStringValue(const QMap &inStr, QMap &val); +template +bool fromStringValue(const QMap &inStr, QMap &val); - template - QJsonValue toJsonValue(const QList &val); +template +QJsonValue toJsonValue(const QList &val); - template - QJsonValue toJsonValue(const QMap &val); +template +QJsonValue toJsonValue(const QMap &val); - template - bool fromJsonValue(QList &val, const QJsonValue &jval); +template +bool fromJsonValue(QList &val, const QJsonValue &jval); - template - bool fromJsonValue(QMap &val, const QJsonValue &jval); - - QString toStringValue(const QString &value); - QString toStringValue(const QDateTime &value); - QString toStringValue(const QByteArray &value); - QString toStringValue(const QDate &value); - QString toStringValue(const qint32 &value); - QString toStringValue(const qint64 &value); - QString toStringValue(const bool &value); - QString toStringValue(const float &value); - QString toStringValue(const double &value); - QString toStringValue(const {{prefix}}Object &value); - QString toStringValue(const {{prefix}}Enum &value); - QString toStringValue(const {{prefix}}HttpFileElement &value); +template +bool fromJsonValue(QMap &val, const QJsonValue &jval); - template - QString toStringValue(const QList &val) { - QString strArray; - for(const auto& item : val) { - strArray.append(toStringValue(item) + ","); - } - if(val.count() > 0) { - strArray.chop(1); - } - return strArray; +QString toStringValue(const QString &value); +QString toStringValue(const QDateTime &value); +QString toStringValue(const QByteArray &value); +QString toStringValue(const QDate &value); +QString toStringValue(const qint32 &value); +QString toStringValue(const qint64 &value); +QString toStringValue(const bool &value); +QString toStringValue(const float &value); +QString toStringValue(const double &value); +QString toStringValue(const {{prefix}}Object &value); +QString toStringValue(const {{prefix}}Enum &value); +QString toStringValue(const {{prefix}}HttpFileElement &value); + +template +QString toStringValue(const QList &val) { + QString strArray; + for (const auto &item : val) { + strArray.append(toStringValue(item) + ","); } - - QJsonValue toJsonValue(const QString &value); - QJsonValue toJsonValue(const QDateTime &value); - QJsonValue toJsonValue(const QByteArray &value); - QJsonValue toJsonValue(const QDate &value); - QJsonValue toJsonValue(const qint32 &value); - QJsonValue toJsonValue(const qint64 &value); - QJsonValue toJsonValue(const bool &value); - QJsonValue toJsonValue(const float &value); - QJsonValue toJsonValue(const double &value); - QJsonValue toJsonValue(const {{prefix}}Object &value); - QJsonValue toJsonValue(const {{prefix}}Enum &value); - QJsonValue toJsonValue(const {{prefix}}HttpFileElement &value); - - template - QJsonValue toJsonValue(const QList &val) { - QJsonArray jArray; - for(const auto& item : val) { - jArray.append(toJsonValue(item)); - } - return jArray; + if (val.count() > 0) { + strArray.chop(1); } + return strArray; +} - template - QJsonValue toJsonValue(const QMap &val) { - QJsonObject jObject; - for(const auto& itemkey : val.keys()) { - jObject.insert(itemkey, toJsonValue(val.value(itemkey))); - } - return jObject; +QJsonValue toJsonValue(const QString &value); +QJsonValue toJsonValue(const QDateTime &value); +QJsonValue toJsonValue(const QByteArray &value); +QJsonValue toJsonValue(const QDate &value); +QJsonValue toJsonValue(const qint32 &value); +QJsonValue toJsonValue(const qint64 &value); +QJsonValue toJsonValue(const bool &value); +QJsonValue toJsonValue(const float &value); +QJsonValue toJsonValue(const double &value); +QJsonValue toJsonValue(const {{prefix}}Object &value); +QJsonValue toJsonValue(const {{prefix}}Enum &value); +QJsonValue toJsonValue(const {{prefix}}HttpFileElement &value); + +template +QJsonValue toJsonValue(const QList &val) { + QJsonArray jArray; + for (const auto &item : val) { + jArray.append(toJsonValue(item)); } + return jArray; +} - bool fromStringValue(const QString &inStr, QString &value); - bool fromStringValue(const QString &inStr, QDateTime &value); - bool fromStringValue(const QString &inStr, QByteArray &value); - bool fromStringValue(const QString &inStr, QDate &value); - bool fromStringValue(const QString &inStr, qint32 &value); - bool fromStringValue(const QString &inStr, qint64 &value); - bool fromStringValue(const QString &inStr, bool &value); - bool fromStringValue(const QString &inStr, float &value); - bool fromStringValue(const QString &inStr, double &value); - bool fromStringValue(const QString &inStr, {{prefix}}Object &value); - bool fromStringValue(const QString &inStr, {{prefix}}Enum &value); - bool fromStringValue(const QString &inStr, {{prefix}}HttpFileElement &value); - - template - bool fromStringValue(const QList &inStr, QList &val) { - bool ok = (inStr.count() > 0); - for(const auto& item: inStr){ - T itemVal; - ok &= fromStringValue(item, itemVal); - val.push_back(itemVal); - } - return ok; +template +QJsonValue toJsonValue(const QMap &val) { + QJsonObject jObject; + for (const auto &itemkey : val.keys()) { + jObject.insert(itemkey, toJsonValue(val.value(itemkey))); } + return jObject; +} - template - bool fromStringValue(const QMap &inStr, QMap &val) { - bool ok = (inStr.count() > 0); - for(const auto& itemkey : inStr.keys()){ - T itemVal; - ok &= fromStringValue(inStr.value(itemkey), itemVal); - val.insert(itemkey, itemVal); - } - return ok; +bool fromStringValue(const QString &inStr, QString &value); +bool fromStringValue(const QString &inStr, QDateTime &value); +bool fromStringValue(const QString &inStr, QByteArray &value); +bool fromStringValue(const QString &inStr, QDate &value); +bool fromStringValue(const QString &inStr, qint32 &value); +bool fromStringValue(const QString &inStr, qint64 &value); +bool fromStringValue(const QString &inStr, bool &value); +bool fromStringValue(const QString &inStr, float &value); +bool fromStringValue(const QString &inStr, double &value); +bool fromStringValue(const QString &inStr, {{prefix}}Object &value); +bool fromStringValue(const QString &inStr, {{prefix}}Enum &value); +bool fromStringValue(const QString &inStr, {{prefix}}HttpFileElement &value); + +template +bool fromStringValue(const QList &inStr, QList &val) { + bool ok = (inStr.count() > 0); + for (const auto &item : inStr) { + T itemVal; + ok &= fromStringValue(item, itemVal); + val.push_back(itemVal); } + return ok; +} - bool fromJsonValue(QString &value, const QJsonValue &jval); - bool fromJsonValue(QDateTime &value, const QJsonValue &jval); - bool fromJsonValue(QByteArray &value, const QJsonValue &jval); - bool fromJsonValue(QDate &value, const QJsonValue &jval); - bool fromJsonValue(qint32 &value, const QJsonValue &jval); - bool fromJsonValue(qint64 &value, const QJsonValue &jval); - bool fromJsonValue(bool &value, const QJsonValue &jval); - bool fromJsonValue(float &value, const QJsonValue &jval); - bool fromJsonValue(double &value, const QJsonValue &jval); - bool fromJsonValue({{prefix}}Object &value, const QJsonValue &jval); - bool fromJsonValue({{prefix}}Enum &value, const QJsonValue &jval); - bool fromJsonValue({{prefix}}HttpFileElement &value, const QJsonValue &jval); +template +bool fromStringValue(const QMap &inStr, QMap &val) { + bool ok = (inStr.count() > 0); + for (const auto &itemkey : inStr.keys()) { + T itemVal; + ok &= fromStringValue(inStr.value(itemkey), itemVal); + val.insert(itemkey, itemVal); + } + return ok; +} - template - bool fromJsonValue(QList &val, const QJsonValue &jval) { - bool ok = true; - if(jval.isArray()){ - for(const auto jitem : jval.toArray()){ - T item; - ok &= fromJsonValue(item, jitem); - val.push_back(item); +bool fromJsonValue(QString &value, const QJsonValue &jval); +bool fromJsonValue(QDateTime &value, const QJsonValue &jval); +bool fromJsonValue(QByteArray &value, const QJsonValue &jval); +bool fromJsonValue(QDate &value, const QJsonValue &jval); +bool fromJsonValue(qint32 &value, const QJsonValue &jval); +bool fromJsonValue(qint64 &value, const QJsonValue &jval); +bool fromJsonValue(bool &value, const QJsonValue &jval); +bool fromJsonValue(float &value, const QJsonValue &jval); +bool fromJsonValue(double &value, const QJsonValue &jval); +bool fromJsonValue({{prefix}}Object &value, const QJsonValue &jval); +bool fromJsonValue({{prefix}}Enum &value, const QJsonValue &jval); +bool fromJsonValue({{prefix}}HttpFileElement &value, const QJsonValue &jval); + +template +bool fromJsonValue(QList &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isArray()) { + for (const auto jitem : jval.toArray()) { + T item; + ok &= fromJsonValue(item, jitem); + val.push_back(item); + } + } else { + ok = false; + } + return ok; +} + +template +bool fromJsonValue(QMap &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isObject()) { + auto varmap = jval.toObject().toVariantMap(); + if (varmap.count() > 0) { + for (const auto &itemkey : varmap.keys()) { + T itemVal; + ok &= fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); + val.insert(itemkey, itemVal); } - } else { - ok = false; } - return ok; - } - - template - bool fromJsonValue(QMap &val, const QJsonValue &jval) { - bool ok = true; - if(jval.isObject()){ - auto varmap = jval.toObject().toVariantMap(); - if(varmap.count() > 0){ - for(const auto& itemkey : varmap.keys() ){ - T itemVal; - ok &= fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); - val.insert(itemkey, itemVal); - } - } - } else { - ok = false; - } - return ok; + } else { + ok = false; } + return ok; +} {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} #endif // {{prefix}}_HELPERS_H diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/licenseInfo.mustache index 9866f297a4d..360883d9f9d 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/licenseInfo.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/licenseInfo.mustache @@ -3,8 +3,8 @@ * {{{appDescription}}} * * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} - * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} - * + *{{#infoEmail}} Contact: {{{infoEmail}}} + *{{/infoEmail}} * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-body.mustache index ea1e8e1411b..05f22ceb8fb 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-body.mustache @@ -1,11 +1,10 @@ -{{>licenseInfo}} -{{#models}}{{#model}} +{{>licenseInfo}}{{#models}}{{#model}} #include "{{classname}}.h" -#include -#include -#include #include +#include +#include +#include #include "{{prefix}}Helpers.h" @@ -22,24 +21,20 @@ namespace {{this}} { this->initializeModel(); } -{{classname}}::~{{classname}}() { +{{classname}}::~{{classname}}() {} -} - -void -{{classname}}::initializeModel() { - {{^isEnum}}{{#vars}} +void {{classname}}::initializeModel() { +{{^isEnum}}{{#vars}} m_{{name}}_isSet = false; - m_{{name}}_isValid = false; - {{/vars}}{{/isEnum}}{{#isEnum}} + m_{{name}}_isValid = false;{{^-last}} +{{/-last}}{{/vars}}{{/isEnum}}{{#isEnum}} m_value_isSet = false; m_value_isValid = false; m_value = e{{classname}}::INVALID_VALUE_OPENAPI_GENERATED;{{/isEnum}} } -void -{{classname}}::fromJson(QString jsonString) { - {{^isEnum}}QByteArray array (jsonString.toStdString().c_str()); +void {{classname}}::fromJson(QString jsonString) { + {{^isEnum}}QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject);{{/isEnum}}{{#isEnum}}{{#allowableValues}}{{#enumVars}} @@ -49,9 +44,8 @@ void }{{/enumVars}}{{/allowableValues}}{{/isEnum}} } -void -{{classname}}::fromJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}}(QJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}} json) { - {{^isEnum}}{{#vars}}{{^isContainer}} +void {{classname}}::fromJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}}(QJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}} json) { +{{^isEnum}}{{#vars}}{{^isContainer}} m_{{name}}_isValid = ::{{cppNamespace}}::fromJsonValue({{name}}, json[QString("{{baseName}}")]); m_{{name}}_isSet = !json[QString("{{baseName}}")].isNull() && m_{{name}}_isValid;{{/isContainer}}{{#isContainer}}{{^items.isContainer}} m_{{name}}_isValid = ::{{cppNamespace}}::fromJsonValue({{name}}, json[QString("{{baseName}}")]); @@ -80,13 +74,12 @@ void {{name}}.insert({{name}}.end(), val, item); } } - }{{/isMapContainer}}{{/items.isContainer}}{{/isContainer}} - {{/vars}}{{/isEnum}}{{#isEnum}} - {{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}fromJson(json.toString());{{/isString}}{{^isString}}m_value = static_cast(json.toInt());{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}{{/isEnum}} + }{{/isMapContainer}}{{/items.isContainer}}{{/isContainer}}{{^-last}} +{{/-last}} +{{/vars}}{{/isEnum}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}fromJson(json.toString());{{/isString}}{{^isString}}m_value = static_cast(json.toInt());{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}{{/isEnum}} } -QString -{{classname}}::asJson () const { +QString {{classname}}::asJson() const { {{^isEnum}}QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); @@ -105,27 +98,24 @@ QString return val;{{/isEnum}} } -QJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}} -{{classname}}::asJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}}() const { - {{^isEnum}}QJsonObject obj;{{#vars}} - {{^isContainer}}{{#complexType}}if({{name}}.isSet()){{/complexType}}{{^complexType}}if(m_{{name}}_isSet){{/complexType}}{ +QJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}} {{classname}}::asJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}}() const { + {{^isEnum}}QJsonObject obj;{{#vars}}{{^isContainer}}{{#complexType}} + if ({{name}}.isSet()){{/complexType}}{{^complexType}} + if (m_{{name}}_isSet){{/complexType}} { obj.insert(QString("{{baseName}}"), ::{{cppNamespace}}::toJsonValue({{name}})); }{{/isContainer}}{{#isContainer}} - if({{name}}.size() > 0){ + if ({{name}}.size() > 0) { {{^items.isContainer}}obj.insert(QString("{{baseName}}"), ::{{cppNamespace}}::toJsonValue({{name}}));{{/items.isContainer}}{{#items.isContainer}} obj.insert(QString("{{baseName}}"), toJsonValue({{name}}));{{/items.isContainer}} - } {{/isContainer}}{{/vars}} + }{{/isContainer}}{{/vars}} return obj;{{/isEnum}}{{#isEnum}} {{#allowableValues}}{{#enumVars}}{{#-first}}{{^isString}}return QJsonValue(static_cast(m_value));{{/isString}}{{#isString}}return QJsonValue(asJson());{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}{{/isEnum}} } -{{^isEnum}}{{#vars}} -{{{dataType}}} -{{classname}}::{{getter}}() const { +{{^isEnum}}{{#vars}}{{{dataType}}} {{classname}}::{{getter}}() const { return {{name}}; } -void -{{classname}}::{{setter}}(const {{{dataType}}} &{{name}}) { +void {{classname}}::{{setter}}(const {{{dataType}}} &{{name}}) { this->{{name}} = {{name}}; this->m_{{name}}_isSet = true; } @@ -140,25 +130,27 @@ void {{classname}}::setValue(const {{classname}}::e{{classname}}& value){ m_value_isSet = true; } {{/isEnum}} -bool -{{classname}}::isSet() const { +bool {{classname}}::isSet() const { {{^isEnum}}bool isObjectUpdated = false; - do{ {{#vars}} - {{#isContainer}}if({{name}}.size() > 0){{/isContainer}}{{^isContainer}}{{#complexType}}if({{name}}.isSet()){{/complexType}}{{^complexType}}if(m_{{name}}_isSet){{/complexType}}{{/isContainer}}{ isObjectUpdated = true; break;} - {{/vars}}}while(false); + do { +{{#vars}} {{#isContainer}}if ({{name}}.size() > 0){{/isContainer}}{{^isContainer}}{{#complexType}}if ({{name}}.isSet()){{/complexType}}{{^complexType}}if (m_{{name}}_isSet){{/complexType}}{{/isContainer}} { + isObjectUpdated = true; + break; + }{{^-last}} + +{{/-last}}{{/vars}} + } while (false); return isObjectUpdated;{{/isEnum}}{{#isEnum}} return m_value_isSet;{{/isEnum}} } -bool -{{classname}}::isValid() const { +bool {{classname}}::isValid() const { // only required properties are required for the object to be considered valid return {{^isEnum}}{{#vars}}{{#required}}m_{{name}}_isValid && {{/required}}{{/vars}}true{{/isEnum}}{{#isEnum}}m_value_isValid{{/isEnum}}; } {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} - {{/model}} {{/models}} 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 27a7c09c7cc..8f194ac12f9 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 @@ -10,13 +10,11 @@ #include -{{/model}}{{/models}} -{{#imports}}{{{import}}} +{{/model}}{{/models}}{{#imports}}{{{import}}} {{/imports}} -#include "{{prefix}}Object.h" #include "{{prefix}}Enum.h" - +#include "{{prefix}}Object.h" {{#models}} {{#model}} @@ -24,22 +22,21 @@ namespace {{this}} { {{/cppNamespaceDeclarations}} -class {{classname}}: public {{prefix}}{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Enum{{/isEnum}} { +class {{classname}} : public {{prefix}}{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Enum{{/isEnum}} { public: {{classname}}(); {{classname}}(QString json); ~{{classname}}() override; - QString asJson () const override; + QString asJson() const override; QJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}} asJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}}() const override; void fromJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}}(QJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}} json) override; void fromJson(QString jsonString) override; - - {{^isEnum}}{{#vars}} +{{^isEnum}}{{#vars}} {{{dataType}}} {{getter}}() const; void {{setter}}(const {{{dataType}}} &{{name}}); - - {{/vars}}{{/isEnum}}{{#isEnum}}{{#allowableValues}} +{{/vars}}{{/isEnum}}{{#isEnum}} +{{#allowableValues}} enum class e{{classname}} {{#enumVars}}{{#-first}}{{^isString}}: int {{/isString}}{{/-first}}{{/enumVars}}{ INVALID_VALUE_OPENAPI_GENERATED = 0, {{#enumVars}} @@ -51,28 +48,25 @@ public: {{{name}}}{{^-last}}, {{/-last}} {{/enumVars}} };{{/allowableValues}} - {{classname}}::e{{classname}} getValue() const; void setValue(const {{classname}}::e{{classname}}& value);{{/isEnum}} - virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); - {{^isEnum}}{{#vars}} +{{^isEnum}}{{#vars}} {{{dataType}}} {{name}}; bool m_{{name}}_isSet; bool m_{{name}}_isValid; - {{/vars}}{{/isEnum}} - {{#isEnum}}e{{classname}} m_value; +{{/vars}}{{/isEnum}}{{#isEnum}} + e{{classname}} m_value; bool m_value_isSet; bool m_value_isValid; - {{/isEnum}} -}; +{{/isEnum}}}; {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{classname}}) 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 e58b49adb92..7a68ecc6f74 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 @@ -2,8 +2,8 @@ #ifndef {{prefix}}_OBJECT_H #define {{prefix}}_OBJECT_H -#include #include +#include #include {{#cppNamespaceDeclarations}} @@ -11,18 +11,14 @@ namespace {{this}} { {{/cppNamespaceDeclarations}} class {{prefix}}Object { - public: - {{prefix}}Object() { - - } +public: + {{prefix}}Object() {} {{prefix}}Object(QString jsonString) { fromJson(jsonString); } - virtual ~{{prefix}}Object(){ - - } + virtual ~{{prefix}}Object() {} virtual QJsonObject asJsonObject() const { return jObj; @@ -49,12 +45,13 @@ class {{prefix}}Object { virtual bool isValid() const { return true; } -private : + +private: QJsonObject jObj; }; {{#cppNamespaceDeclarations}} -} +} // namespace {{this}} {{/cppNamespaceDeclarations}} Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{prefix}}Object) diff --git a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache b/modules/openapi-generator/src/main/resources/go-experimental/api.mustache index 71a46c4450b..067704ec555 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/api.mustache @@ -78,7 +78,8 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams // create path and map variables localVarPath := a.client.cfg.BasePath + "{{{path}}}"{{#pathParams}} - localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", {{paramName}})), -1){{/pathParams}} + localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1) + {{/pathParams}} localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/client.mustache b/modules/openapi-generator/src/main/resources/go-experimental/client.mustache index cefd6c7c409..6b26a31bea2 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/client.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/client.mustache @@ -9,8 +9,10 @@ import ( "errors" "fmt" "io" + "log" "mime/multipart" "net/http" + "net/http/httputil" "net/url" "os" "path/filepath" @@ -161,7 +163,27 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - return c.cfg.HTTPClient.Do(request) + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err } // ChangeBasePath changes base path to allow switching to mocks diff --git a/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache b/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache index 0b74d83401f..9d52ea1f528 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache @@ -2,7 +2,9 @@ package {{packageName}} import ( + "fmt" "net/http" + "strings" ) // contextKeys are used to identify the type of value in the context. @@ -41,6 +43,20 @@ type APIKey struct { Prefix string } +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + // Configuration stores the configuration of the API client type Configuration struct { BasePath string `json:"basePath,omitempty"` @@ -48,6 +64,8 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration HTTPClient *http.Client } @@ -57,6 +75,39 @@ func NewConfiguration() *Configuration { BasePath: "{{{basePath}}}", DefaultHeader: make(map[string]string), UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/go{{/httpUserAgent}}", + Debug: false, + {{#servers}} + {{#-first}} + Servers: []ServerConfiguration{{ + {{/-first}} + Url: "{{{url}}}", + Description: "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + Variables: map[string]ServerVariable{ + {{/-first}} + "{{{name}}}": ServerVariable{ + Description: "{{{description}}}{{^description}}No description provided{{/description}}", + DefaultValue: "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + EnumValues: []string{ + {{/-first}} + "{{{.}}}", + {{#-last}} + }, + {{/-last}} + {{/enumValues}} + }, + {{#-last}} + }, + {{/-last}} + {{/variables}} + }, + {{#-last}} + }, + {{/-last}} + {{/servers}} } return cfg } @@ -65,3 +116,31 @@ func NewConfiguration() *Configuration { func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} diff --git a/modules/openapi-generator/src/main/resources/go-server/go.mod.mustache b/modules/openapi-generator/src/main/resources/go-server/go.mod.mustache new file mode 100644 index 00000000000..18f7e897253 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-server/go.mod.mustache @@ -0,0 +1,5 @@ +module {{gitHost}}/{{gitUserId}}/{{gitRepoId}} + +go 1.13 + +require github.com/gorilla/mux v1.7.3 diff --git a/modules/openapi-generator/src/main/resources/go-server/main.mustache b/modules/openapi-generator/src/main/resources/go-server/main.mustache index 377e7122e1b..ab7516375a8 100644 --- a/modules/openapi-generator/src/main/resources/go-server/main.mustache +++ b/modules/openapi-generator/src/main/resources/go-server/main.mustache @@ -5,14 +5,7 @@ import ( "log" "net/http" - // WARNING! - // Change this to a fully-qualified import path - // once you place this file into your project. - // For example, - // - // sw "github.com/myname/myrepo/{{sourceFolder}}" - // - {{packageName}} "./{{sourceFolder}}" + {{packageName}} "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/{{sourceFolder}}" ) func main() { diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index d1dcafdfd8b..503e3fcac4c 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -78,7 +78,8 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams // create path and map variables localVarPath := a.client.cfg.BasePath + "{{{path}}}"{{#pathParams}} - localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", {{paramName}})), -1){{/pathParams}} + localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1) + {{/pathParams}} localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index cefd6c7c409..a7c6802a0b8 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -9,8 +9,10 @@ import ( "errors" "fmt" "io" + "log" "mime/multipart" "net/http" + "net/http/httputil" "net/url" "os" "path/filepath" @@ -161,7 +163,28 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - return c.cfg.HTTPClient.Do(request) + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + + return resp, err } // ChangeBasePath changes base path to allow switching to mocks diff --git a/modules/openapi-generator/src/main/resources/go/configuration.mustache b/modules/openapi-generator/src/main/resources/go/configuration.mustache index 98f9d8fee26..e6fa96d2057 100644 --- a/modules/openapi-generator/src/main/resources/go/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/go/configuration.mustache @@ -2,7 +2,9 @@ package {{packageName}} import ( + "fmt" "net/http" + "strings" ) // contextKeys are used to identify the type of value in the context. @@ -41,6 +43,20 @@ type APIKey struct { Prefix string } +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + // Configuration stores the configuration of the API client type Configuration struct { BasePath string `json:"basePath,omitempty"` @@ -48,6 +64,8 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration HTTPClient *http.Client } @@ -57,6 +75,39 @@ func NewConfiguration() *Configuration { BasePath: "{{{basePath}}}", DefaultHeader: make(map[string]string), UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/go{{/httpUserAgent}}", + Debug: false, + {{#servers}} + {{#-first}} + Servers: []ServerConfiguration{{ + {{/-first}} + Url: "{{{url}}}", + Description: "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + Variables: map[string]ServerVariable{ + {{/-first}} + "{{{name}}}": ServerVariable{ + Description: "{{{description}}}{{^description}}No description provided{{/description}}", + DefaultValue: "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + EnumValues: []string{ + {{/-first}} + "{{{.}}}", + {{#-last}} + }, + {{/-last}} + {{/enumValues}} + }, + {{#-last}} + }, + {{/-last}} + {{/variables}} + }, + {{#-last}} + }, + {{/-last}} + {{/servers}} } return cfg } @@ -65,3 +116,31 @@ func NewConfiguration() *Configuration { func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} diff --git a/modules/openapi-generator/src/main/resources/java-msf4j-server/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/java-msf4j-server/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-msf4j-server/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-msf4j-server/pojo.mustache b/modules/openapi-generator/src/main/resources/java-msf4j-server/pojo.mustache index 38559db8fb4..7f44c8fd125 100644 --- a/modules/openapi-generator/src/main/resources/java-msf4j-server/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/java-msf4j-server/pojo.mustache @@ -2,7 +2,7 @@ * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} */{{#description}} @ApiModel(description = "{{{description}}}"){{/description}} -{{>generatedAnnotation}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}} {{#isEnum}} diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-pkmst/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/pojo.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/pojo.mustache index 5b853d80943..ddf67509268 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/pojo.mustache @@ -3,7 +3,7 @@ */{{#description}} @ApiModel(description = "{{{description}}}"){{/description}} {{#useBeanValidation}}@Validated{{/useBeanValidation}} -{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}{{>additionalModelTypeAnnotations}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#serializableModel}} private static final long serialVersionUID = 1L; diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/additionalModelTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/additionalModelTypeAnnotations.mustache new file mode 100644 index 00000000000..e5dc1ac1295 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{.}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/pojo.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/pojo.mustache index 5fb61ee6fc0..6590268dc96 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/pojo.mustache @@ -1,5 +1,5 @@ {{#description}}@ApiModel(description = "{{{description}}}"){{/description}} -{{>generatedAnnotation}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}}{{^isContainer}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache index 9a32aebeb5d..ff0fc3a4ce5 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache @@ -9,4 +9,4 @@ @SerializedName("{{{vendorExtensions.x-base-name-literal}}}") {{/gson}} {{/jvm}} - {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") {{/multiplatform}}val {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file + {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") {{/multiplatform}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache index c03711b6884..c7a068e7ca3 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache @@ -9,4 +9,4 @@ @SerializedName("{{{vendorExtensions.x-base-name-literal}}}") {{/gson}} {{/jvm}} - {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{/multiplatform}}val {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} \ No newline at end of file + {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{/multiplatform}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache index ff7e68a98fc..d4b5a587d4c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache @@ -1,5 +1,6 @@ package {{packageName}}.infrastructure +import okhttp3.Credentials import okhttp3.OkHttpClient import okhttp3.RequestBody {{#jvm-okhttp3}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/modelMutable.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/modelMutable.mustache new file mode 100644 index 00000000000..4c7f3900717 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/modelMutable.mustache @@ -0,0 +1 @@ +{{#modelMutable}}var{{/modelMutable}}{{^modelMutable}}val{{/modelMutable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/data_class_opt_var.mustache index 8bcc20d0fca..b1060118732 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/data_class_opt_var.mustache @@ -1,4 +1,4 @@ {{#description}} /* {{{description}}} */ {{/description}} - val {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file + {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/data_class_req_var.mustache index f8ffa6cde82..c79bfec01bd 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/data_class_req_var.mustache @@ -1,4 +1,4 @@ {{#description}} /* {{{description}}} */ {{/description}} - val {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} \ No newline at end of file + {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/modelMutable.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/modelMutable.mustache new file mode 100644 index 00000000000..4c7f3900717 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-server/modelMutable.mustache @@ -0,0 +1 @@ +{{#modelMutable}}var{{/modelMutable}}{{^modelMutable}}val{{/modelMutable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache index 767595052b7..799807798da 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache @@ -1,4 +1,4 @@ {{#useBeanValidation}}{{#required}} {{^isReadOnly}}@get:NotNull{{/isReadOnly}} {{/required}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swaggerAnnotations}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}} - @JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} val {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file + @JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache index f53fadc9b18..b7765a3e42b 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache @@ -1,4 +1,4 @@ {{#useBeanValidation}}{{#required}} {{^isReadOnly}}@get:NotNull{{/isReadOnly}} {{/required}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swaggerAnnotations}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}} - @JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} val {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isReadOnly}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}}{{/isReadOnly}} \ No newline at end of file + @JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isReadOnly}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}}{{/isReadOnly}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache index 8db4ba7698f..8b3a9b23599 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache @@ -1,3 +1,3 @@ {{#swaggerAnnotations}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}} - val {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? {{^discriminator}}= {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}}{{/discriminator}} \ No newline at end of file + {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? {{^discriminator}}= {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}}{{/discriminator}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache index 5f6eea31139..747a12292be 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache @@ -1,3 +1,3 @@ {{#swaggerAnnotations}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}} - val {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} \ No newline at end of file + {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/modelMutable.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/modelMutable.mustache new file mode 100644 index 00000000000..4c7f3900717 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/modelMutable.mustache @@ -0,0 +1 @@ +{{#modelMutable}}var{{/modelMutable}}{{^modelMutable}}val{{/modelMutable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class.mustache index d4c099d64ea..74aa6aa1f26 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class.mustache @@ -36,7 +36,7 @@ data class {{classname}} ( } {{/isEnum}}{{/vars}}{{/hasEnums}} {{#requiredVars}} - var {{{name}}} get() = _{{{name}}} ?: throw IllegalArgumentException("{{{name}}} is required") - set(value){ _{{{name}}} = value } + {{>modelMutable}} {{{name}}} get() = _{{{name}}} ?: throw IllegalArgumentException("{{{name}}} is required") + {{#modelMutable}}set(value){ _{{{name}}} = value }{{/modelMutable}} {{/requiredVars}} } diff --git a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class_opt_var.mustache index 809b0075868..b1060118732 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class_opt_var.mustache @@ -1,4 +1,4 @@ {{#description}} /* {{{description}}} */ {{/description}} - var {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file + {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class_req_var.mustache index 66ec56120be..6a5b5280bb7 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/data_class_req_var.mustache @@ -1,4 +1,4 @@ {{#description}} /* {{{description}}} */ {{/description}} - @SerializedName("{{{name}}}") private var _{{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? \ No newline at end of file + @SerializedName("{{{name}}}") private {{>modelMutable}} _{{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/modelMutable.mustache b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/modelMutable.mustache new file mode 100644 index 00000000000..4c7f3900717 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/modelMutable.mustache @@ -0,0 +1 @@ +{{#modelMutable}}var{{/modelMutable}}{{^modelMutable}}val{{/modelMutable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache index d7ddf7b2384..eda33894db3 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache @@ -1,4 +1,5 @@ getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -219,7 +219,7 @@ use {{invokerPackage}}\ObjectSerializer; if ('{{dataType}}' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -238,7 +238,7 @@ use {{invokerPackage}}\ObjectSerializer; if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -353,7 +353,7 @@ use {{invokerPackage}}\ObjectSerializer; if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/README.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/README.mustache index 3402bd835d9..a9730470093 100644 --- a/modules/openapi-generator/src/main/resources/python-aiohttp/README.mustache +++ b/modules/openapi-generator/src/main/resources/python-aiohttp/README.mustache @@ -3,9 +3,9 @@ ## Overview This server 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 a server stub. This -is an example of building a OpenAPI-enabled aiohtpp server. +is an example of building a OpenAPI-enabled aiohttp server. -This example uses the [Connexion](https://github.com/zalando/connexion) library on top of aiohtpp. +This example uses the [Connexion](https://github.com/zalando/connexion) library on top of aiohttp. ## Requirements Python 3.5.2+ diff --git a/modules/openapi-generator/src/main/resources/python-flask/travis.mustache b/modules/openapi-generator/src/main/resources/python-flask/travis.mustache index 167826e42b4..e03b816ecc0 100644 --- a/modules/openapi-generator/src/main/resources/python-flask/travis.mustache +++ b/modules/openapi-generator/src/main/resources/python-flask/travis.mustache @@ -8,8 +8,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/modules/openapi-generator/src/main/resources/python/travis.mustache b/modules/openapi-generator/src/main/resources/python/travis.mustache index 86211e2d4a2..388de83128f 100644 --- a/modules/openapi-generator/src/main/resources/python/travis.mustache +++ b/modules/openapi-generator/src/main/resources/python/travis.mustache @@ -6,8 +6,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/modules/openapi-generator/src/main/resources/r/NAMESPACE.mustache b/modules/openapi-generator/src/main/resources/r/NAMESPACE.mustache index b92da8e8b6e..fae0e548448 100644 --- a/modules/openapi-generator/src/main/resources/r/NAMESPACE.mustache +++ b/modules/openapi-generator/src/main/resources/r/NAMESPACE.mustache @@ -4,6 +4,9 @@ # Core export(ApiClient) export(ApiResponse) +{{#useRlangExceptionHandling}} +export(ApiException) +{{/useRlangExceptionHandling}} # Models {{#models}} diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index 0fc38a78916..5fc18ec87e9 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -26,7 +26,7 @@ #' \item \emph{ @param } {{paramName}} list( {{dataType}} ) {{/isPrimitiveType}} {{^isPrimitiveType}} -#' \item \emph{ @param } {{paramName}} list( \link[{{packageName}}:{{baseType}}]{ {{dataType}} } ) +#' \item \emph{ @param } {{paramName}} list( \link{{=<% %>=}}{<%dataType%>}<%={{ }}=%> ) {{/isPrimitiveType}} {{/items}} {{/isListContainer}} @@ -35,7 +35,7 @@ #' \item \emph{ @param } {{paramName}} named list( {{dataType}} ) {{/isPrimitiveType}} {{^isPrimitiveType}} -#' \item \emph{ @param } {{paramName}} named list( \link[{{packageName}}:{{baseType}}]{ {{dataType}} } ) +#' \item \emph{ @param } {{paramName}} named list( \link{{=<% %>=}}{<%dataType%>}<%={{ }}=%> ) {{/isPrimitiveType}} {{/isMapContainer}} {{/isContainer}} @@ -44,14 +44,14 @@ #' \item \emph{ @param } {{paramName}} {{dataType}} {{/isPrimitiveType}} {{^isPrimitiveType}} -#' \item \emph{ @param } {{paramName}} \link[{{packageName}}:{{baseType}}]{ {{dataType}} } +#' \item \emph{ @param } {{paramName}} \link{{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{/isPrimitiveType}} {{/isContainer}} {{/isEnum}} {{/allParams}} {{#returnType}} {{^returnTypeIsPrimitive}} -#' \item \emph{ @returnType } \link[{{packageName}}:{{returnBaseType}}]{ {{#returnContainer}}{{#isListContainer}}list({{returnBaseType}}){{/isListContainer}}{{#isMapContainer}}named list({{returnBaseType}}){{/isMapContainer}}{{/returnContainer}}{{^returnContainer}}{{returnType}}{{/returnContainer}} } \cr +#' \item \emph{ @returnType } {{#returnContainer}}{{#isListContainer}}list( {{/isListContainer}}{{#isMapContainer}}named list( {{/isMapContainer}}{{/returnContainer}}\link{{=<% %>=}}{<%#returnContainer%><%={{ }}=%>{{returnBaseType}}{{/returnContainer}}{{^returnContainer}}{{returnType}}{{=<% %>=}}<%/returnContainer%>}<%={{ }}=%>{{#returnContainer}}{{#isListContainer}} ){{/isListContainer}}{{#isMapContainer}} ){{/isMapContainer}}{{/returnContainer}} \cr {{/returnTypeIsPrimitive}} {{/returnType}} #' @@ -276,7 +276,7 @@ {{/isPrimitiveType}} {{^isPrimitiveType}} deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "{{returnType}}", "package:{{packageName}}"), + self$apiClient$deserialize(resp, "{{returnType}}", loadNamespace("{{packageName}}")), error = function(e){ {{#useDefaultExceptionHandling}} stop("Failed to deserialize response") 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 eb70bad3447..22fd994ab64 100644 --- a/modules/openapi-generator/src/main/resources/r/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/r/api_client.mustache @@ -151,10 +151,12 @@ ApiClient <- R6::R6Class( } } } 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) + if(!is.null(nrow(obj))){ + 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) + } } } } diff --git a/modules/openapi-generator/src/main/resources/r/model.mustache b/modules/openapi-generator/src/main/resources/r/model.mustache index ee20e432e74..bf04a122144 100644 --- a/modules/openapi-generator/src/main/resources/r/model.mustache +++ b/modules/openapi-generator/src/main/resources/r/model.mustache @@ -6,7 +6,7 @@ #' @description {{classname}} Class #' @format An \code{R6Class} generator object {{#vars}} -#' @field {{baseName}} {{title}} {{^isPrimitiveType}} \link[{{packageName}}:{{complexType}}]{ {{/isPrimitiveType}} {{#isContainer}} {{#isListContainer}}list({{#items}}{{dataType}}{{/items}}){{/isListContainer}}{{#isMapContainer}}named list({{#items}}{{dataType}}{{/items}}){{/isMapContainer}} {{/isContainer}}{{^isContainer}}{{dataType}}{{/isContainer}} {{^isPrimitiveType}} } {{/isPrimitiveType}} {{^required}}[optional]{{/required}} +#' @field {{baseName}} {{title}} {{#isContainer}}{{#isListContainer}}list( {{/isListContainer}}{{#isMapContainer}}named list( {{/isMapContainer}}{{/isContainer}}{{^isPrimitiveType}}\link{{=<% %>=}}{<%/isPrimitiveType%><%={{ }}=%>{{#isContainer}}{{#items}}{{dataType}}{{/items}}{{/isContainer}}{{^isContainer}}{{dataType}}{{/isContainer}}{{=<% %>=}}<%^isPrimitiveType%>}<%={{ }}=%>{{/isPrimitiveType}}{{#isContainer}}{{#isListContainer}} ){{/isListContainer}}{{#isMapContainer}} ){{/isMapContainer}}{{/isContainer}} {{^required}}[optional]{{/required}} #' {{/vars}} #' @@ -145,7 +145,7 @@ {{#vars}} if (!is.null({{classname}}Object$`{{baseName}}`)) { {{#isContainer}} - self$`{{baseName}}` <- ApiClient$new()$deserializeObj({{classname}}Object$`{{baseName}}`, "{{dataType}}", "package:{{packageName}}") + self$`{{baseName}}` <- ApiClient$new()$deserializeObj({{classname}}Object$`{{baseName}}`, "{{dataType}}", loadNamespace("{{packageName}}")) {{/isContainer}} {{^isContainer}} {{#isPrimitiveType}} @@ -226,7 +226,7 @@ {{#vars}} {{! AAPI - added condition for handling container type of parameters, map and array}} {{#isContainer}} - self$`{{baseName}}` <- ApiClient$new()$deserializeObj({{classname}}Object$`{{baseName}}`, "{{dataType}}","package:{{packageName}}") + self$`{{baseName}}` <- ApiClient$new()$deserializeObj({{classname}}Object$`{{baseName}}`, "{{dataType}}", loadNamespace("{{packageName}}")) {{/isContainer}} {{^isContainer}} {{#isPrimitiveType}} 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 72f6fe90e28..3c2f87e37e4 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache @@ -217,13 +217,13 @@ module {{moduleName}} {{#servers}} { url: "{{{url}}}", - description: "{{{description}}}{{^description}}No descriptoin provided{{/description}}", + description: "{{{description}}}{{^description}}No description provided{{/description}}", {{#variables}} {{#-first}} variables: { {{/-first}} {{{name}}}: { - description: "{{{description}}}{{^description}}No descriptoin provided{{/description}}", + description: "{{{description}}}{{^description}}No description provided{{/description}}", default_value: "{{{defaultValue}}}", {{#enumValues}} {{#-first}} diff --git a/modules/openapi-generator/src/main/resources/ruby-client/faraday_configuration.mustache b/modules/openapi-generator/src/main/resources/ruby-client/faraday_configuration.mustache deleted file mode 100644 index 67aaaf4f00f..00000000000 --- a/modules/openapi-generator/src/main/resources/ruby-client/faraday_configuration.mustache +++ /dev/null @@ -1,300 +0,0 @@ -=begin -{{> api_info}} -=end - -module {{moduleName}} - class Configuration - # Defines url scheme - attr_accessor :scheme - - # Defines url host - attr_accessor :host - - # Defines url base path - attr_accessor :base_path - - # Defines API keys used with API Key authentications. - # - # @return [Hash] key: parameter name, value: parameter value (API key) - # - # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) - # config.api_key['api_key'] = 'xxx' - attr_accessor :api_key - - # Defines API key prefixes used with API Key authentications. - # - # @return [Hash] key: parameter name, value: API key prefix - # - # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) - # config.api_key_prefix['api_key'] = 'Token' - attr_accessor :api_key_prefix - - # Defines the username used with HTTP basic authentication. - # - # @return [String] - attr_accessor :username - - # Defines the password used with HTTP basic authentication. - # - # @return [String] - attr_accessor :password - - # Defines the access token (Bearer) used with OAuth2. - attr_accessor :access_token - - # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response - # details will be logged with `logger.debug` (see the `logger` attribute). - # Default to false. - # - # @return [true, false] - attr_accessor :debugging - - # Defines the logger used for debugging. - # Default to `Rails.logger` (when in Rails) or logging to STDOUT. - # - # @return [#debug] - attr_accessor :logger - - # Defines the temporary folder to store downloaded files - # (for API endpoints that have file response). - # Default to use `Tempfile`. - # - # @return [String] - attr_accessor :temp_folder_path - - # The time limit for HTTP request in seconds. - # Default to 0 (never times out). - attr_accessor :timeout - - # Set this to false to skip client side validation in the operation. - # Default to true. - # @return [true, false] - attr_accessor :client_side_validation - - # Set this to false to skip client side validation in the operation. - # Default to true. - # @return [true, false] - attr_accessor :client_side_validation - - ### TLS/SSL setting - # Set this to false to skip verifying SSL certificate when calling API from https server. - # Default to true. - # - # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. - # - # @return [true, false] - attr_accessor :ssl_verify - - ### TLS/SSL setting - # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html) - # - # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. - # - attr_accessor :ssl_verify_mode - - ### TLS/SSL setting - # Set this to customize the certificate file to verify the peer. - # - # @return [String] the path to the certificate file - attr_accessor :ssl_ca_file - - ### TLS/SSL setting - # Client certificate file (for client certificate) - attr_accessor :ssl_client_cert - - ### TLS/SSL setting - # Client private key file (for client certificate) - attr_accessor :ssl_client_key - - # Set this to customize parameters encoding of array parameter with multi collectionFormat. - # Default to nil. - # - # @see The params_encoding option of Ethon. Related source code: - # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 - attr_accessor :params_encoding - - attr_accessor :inject_format - - attr_accessor :force_ending_format - - def initialize - @scheme = 'http' - @host = 'localhost' - @base_path = '' - @api_key = {} - @api_key_prefix = {} - @params_encoding = nil - @timeout = 0 - @client_side_validation = true - @ssl_verify = true - @ssl_verify_mode = nil - @ssl_ca_file = nil - @ssl_client_cert = nil - @ssl_client_key = nil - @debugging = false - @inject_format = false - @force_ending_format = false - @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) - - yield(self) if block_given? - end - - # The default Configuration object. - def self.default - @@default ||= Configuration.new - end - - def configure - yield(self) if block_given? - end - - def scheme=(scheme) - # remove :// from scheme - @scheme = scheme.sub(/:\/\//, '') - end - - def host=(host) - # remove http(s):// and anything after a slash - @host = host.sub(/https?:\/\//, '').split('/').first - end - - def base_path=(base_path) - # Add leading and trailing slashes to base_path - @base_path = "/#{base_path}".gsub(/\/+/, '/') - @base_path = '' if @base_path == '/' - end - - def base_url - "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') - end - - # Gets API key (with prefix if set). - # @param [String] param_name the parameter name of API key auth - def api_key_with_prefix(param_name) - if @api_key_prefix[param_name] - "#{@api_key_prefix[param_name]} #{@api_key[param_name]}" - else - @api_key[param_name] - end - end - - # Gets Basic Auth token string - def basic_auth_token - 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") - end - - # Returns Auth Settings hash for api client. - def auth_settings - { -{{#authMethods}} -{{#isApiKey}} - '{{name}}' => - { - type: 'api_key', - in: {{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}}, - key: '{{keyParamName}}', - value: api_key_with_prefix('{{keyParamName}}') - }, -{{/isApiKey}} -{{#isBasic}} -{{^isBasicBearer}} - '{{name}}' => - { - type: 'basic', - in: 'header', - key: 'Authorization', - value: basic_auth_token - }, -{{/isBasicBearer}} -{{#isBasicBearer}} - '{{name}}' => - { - type: 'bearer', - in: 'header', - {{#bearerFormat}} - format: '{{{.}}}', - {{/bearerFormat}} - key: 'Authorization', - value: "Bearer #{access_token}" - }, -{{/isBasicBearer}} -{{/isBasic}} -{{#isOAuth}} - '{{name}}' => - { - type: 'oauth2', - in: 'header', - key: 'Authorization', - value: "Bearer #{access_token}" - }, -{{/isOAuth}} -{{/authMethods}} - } - end - - # Returns an array of Server setting - def server_settings - [ - {{#servers}} - { - url: "{{{url}}}", - description: "{{{description}}}{{^description}}No descriptoin provided{{/description}}", - {{#variables}} - {{#-first}} - variables: { - {{/-first}} - {{{name}}}: { - description: "{{{description}}}{{^description}}No descriptoin provided{{/description}}", - default_value: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - enum_values: [ - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/enumValues}} - }{{^-last}},{{/-last}} - {{#-last}} - } - {{/-last}} - {{/variables}} - }{{^-last}},{{/-last}} - {{/servers}} - ] - end - - # Returns URL based on server settings - # - # @param index array index of the server settings - # @param variables hash of variable and the corresponding value - def server_url(index, variables = {}) - servers = server_settings - - # check array index out of bound - if (index < 0 || index >= servers.size) - fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" - end - - server = servers[index] - url = server[:url] - - # go through variable and assign a value - server[:variables].each do |name, variable| - if variables.key?(name) - if (server[:variables][name][:enum_values].include? variables[name]) - url.gsub! "{" + name.to_s + "}", variables[name] - else - fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." - end - else - # use default value - url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] - end - end - - url - end - end -end diff --git a/modules/openapi-generator/src/main/resources/swift4/APIHelper.mustache b/modules/openapi-generator/src/main/resources/swift4/APIHelper.mustache index d94614b34fc..368722c9fe9 100644 --- a/modules/openapi-generator/src/main/resources/swift4/APIHelper.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/APIHelper.mustache @@ -6,8 +6,8 @@ import Foundation -public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct APIHelper { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,7 +20,7 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { return source.reduce(into: [String: String]()) { (result, item) in if let collection = item.value as? Array { result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") @@ -30,7 +30,7 @@ public struct APIHelper { } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { guard let source = source else { return nil } @@ -45,14 +45,14 @@ public struct APIHelper { }) } - public static func mapValueToPathItem(_ source: Any) -> Any { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func mapValueToPathItem(_ source: Any) -> Any { if let collection = source as? Array { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in if let collection = item.value as? Array { let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") diff --git a/modules/openapi-generator/src/main/resources/swift4/APIs.mustache b/modules/openapi-generator/src/main/resources/swift4/APIs.mustache index 6ed1abe5694..0c3f78b057c 100644 --- a/modules/openapi-generator/src/main/resources/swift4/APIs.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/APIs.mustache @@ -6,25 +6,26 @@ import Foundation -open class {{projectName}}API { - public static var basePath = "{{{basePath}}}" - public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] - public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{projectName}}API { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var basePath = "{{{basePath}}}" + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var credential: URLCredential? + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var customHeaders: [String:String] = [:] + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var apiResponseQueue: DispatchQueue = .main } -open class RequestBuilder { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder { var credential: URLCredential? var headers: [String:String] - public let parameters: [String:Any]? - public let isBody: Bool - public let method: String - public let URLString: String + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String:Any]? + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let isBody: Bool + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let method: String + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let URLString: String /// Optional block to obtain a reference to the request's progress instance when available. - public var onProgressReady: ((Progress) -> ())? + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var onProgressReady: ((Progress) -> ())? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -34,28 +35,28 @@ open class RequestBuilder { addHeaders({{projectName}}API.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func addHeaders(_ aHeaders:[String:String]) { for (header, value) in aHeaders { headers[header] = value } } - open func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { } + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { } - public func addHeader(name: String, value: String) -> Self { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func addHeader(name: String, value: String) -> Self { if !value.isEmpty { headers[name] = value } return self } - open func addCredential() -> Self { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func addCredential() -> Self { self.credential = {{projectName}}API.credential return self } } -public protocol RequestBuilderFactory { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/modules/openapi-generator/src/main/resources/swift4/AlamofireImplementations.mustache b/modules/openapi-generator/src/main/resources/swift4/AlamofireImplementations.mustache index dac40e9a31c..d0750a5fd00 100644 --- a/modules/openapi-generator/src/main/resources/swift4/AlamofireImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/AlamofireImplementations.mustache @@ -28,7 +28,7 @@ private struct SynchronizedDictionary { target: nil ) - public subscript(key: K) -> V? { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} subscript(key: K) -> V? { get { var value: V? @@ -49,8 +49,8 @@ private struct SynchronizedDictionary { // Store manager to retain its reference private var managerStore = SynchronizedDictionary() -open class AlamofireRequestBuilder: RequestBuilder { - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireRequestBuilder: RequestBuilder { + required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } @@ -58,7 +58,7 @@ open class AlamofireRequestBuilder: RequestBuilder { May be overridden by a subclass if you want to control the session configuration. */ - open func createSessionManager() -> Alamofire.SessionManager { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func createSessionManager() -> Alamofire.SessionManager { let configuration = URLSessionConfiguration.default configuration.httpAdditionalHeaders = buildHeaders() return Alamofire.SessionManager(configuration: configuration) @@ -67,7 +67,7 @@ open class AlamofireRequestBuilder: RequestBuilder { /** May be overridden by a subclass if you want to custom request constructor. */ - open func createURLRequest() -> URLRequest? { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func createURLRequest() -> URLRequest? { let encoding: ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding() guard let originalRequest = try? URLRequest(url: URLString, method: HTTPMethod(rawValue: method)!, headers: buildHeaders()) else { return nil } return try? encoding.encode(originalRequest, with: parameters) @@ -80,7 +80,7 @@ open class AlamofireRequestBuilder: RequestBuilder { Return nil to use the default behavior (inferring the Content-Type from the file extension). Return the desired Content-Type otherwise. */ - open func contentTypeForFormPart(fileURL: URL) -> String? { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func contentTypeForFormPart(fileURL: URL) -> String? { return nil } @@ -88,11 +88,11 @@ open class AlamofireRequestBuilder: RequestBuilder { May be overridden by a subclass if you want to control the request configuration (e.g. to override the cache policy). */ - open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest { return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers) } - override open func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { let managerId:String = UUID().uuidString // Create a new manager for each request to customize its request header let manager = createSessionManager() @@ -157,7 +157,7 @@ open class AlamofireRequestBuilder: RequestBuilder { switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: {{projectName}}API.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -177,7 +177,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) case is URL.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: {{projectName}}API.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() do { @@ -227,7 +227,7 @@ open class AlamofireRequestBuilder: RequestBuilder { return }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: {{projectName}}API.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -246,7 +246,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: {{projectName}}API.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -268,7 +268,7 @@ open class AlamofireRequestBuilder: RequestBuilder { } } - open func buildHeaders() -> [String: String] { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func buildHeaders() -> [String: String] { var httpHeaders = SessionManager.defaultHTTPHeaders for (key, value) in self.headers { httpHeaders[key] = value @@ -337,14 +337,14 @@ fileprivate enum DownloadException : Error { case requestMissingURL } -public enum AlamofireDecodableRequestBuilderError: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum AlamofireDecodableRequestBuilderError: Error { case emptyDataResponse case nilHTTPResponse case jsonDecoding(DecodingError) case generalError(Error) } -open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder { override fileprivate func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { if let credential = self.credential { @@ -359,7 +359,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: {{projectName}}API.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -379,7 +379,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde ) }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: {{projectName}}API.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -398,7 +398,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde ) }) case is Data.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: {{projectName}}API.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -418,7 +418,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + validatedRequest.responseData(queue: {{projectName}}API.apiResponseQueue, completionHandler: { (dataResponse: DataResponse) in cleanupRequest() guard dataResponse.result.isSuccess else { diff --git a/modules/openapi-generator/src/main/resources/swift4/CodableHelper.mustache b/modules/openapi-generator/src/main/resources/swift4/CodableHelper.mustache index 584de8c3d57..b0db903483b 100644 --- a/modules/openapi-generator/src/main/resources/swift4/CodableHelper.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/CodableHelper.mustache @@ -7,13 +7,13 @@ import Foundation -public typealias EncodeResult = (data: Data?, error: Error?) +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} typealias EncodeResult = (data: Data?, error: Error?) -open class CodableHelper { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class CodableHelper { - public static var dateformatter: DateFormatter? + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var dateformatter: DateFormatter? - open class func decode(_ type: T.Type, from data: Data) -> (decodableObj: T?, error: Error?) where T : Decodable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func decode(_ type: T.Type, from data: Data) -> (decodableObj: T?, error: Error?) where T : Decodable { var returnedDecodable: T? = nil var returnedError: Error? = nil @@ -39,7 +39,7 @@ open class CodableHelper { return (returnedDecodable, returnedError) } - open class func encode(_ value: T, prettyPrint: Bool = false) -> EncodeResult where T : Encodable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encode(_ value: T, prettyPrint: Bool = false) -> EncodeResult where T : Encodable { var returnedData: Data? var returnedError: Error? = nil diff --git a/modules/openapi-generator/src/main/resources/swift4/Configuration.mustache b/modules/openapi-generator/src/main/resources/swift4/Configuration.mustache index 516590da5d9..92a05e46c67 100644 --- a/modules/openapi-generator/src/main/resources/swift4/Configuration.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/Configuration.mustache @@ -6,10 +6,10 @@ import Foundation -open class Configuration { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class Configuration { // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. - public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift4/Extensions.mustache b/modules/openapi-generator/src/main/resources/swift4/Extensions.mustache index a4ed6ae9c02..0fb2e44a4a3 100644 --- a/modules/openapi-generator/src/main/resources/swift4/Extensions.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/Extensions.mustache @@ -4,8 +4,7 @@ // https://openapi-generator.tech // -import Foundation -import Alamofire{{#usePromiseKit}} +import Foundation{{#usePromiseKit}} import PromiseKit{{/usePromiseKit}} extension Bool: JSONEncodable { @@ -36,6 +35,10 @@ extension String: JSONEncodable { func encodeToJSON() -> Any { return self as Any } } +extension RawRepresentable where RawValue: JSONEncodable { + func encodeToJSON() -> Any { return self.rawValue as Any } +} + private func encodeIfPossible(_ object: T) -> Any { if let encodableObject = object as? JSONEncodable { return encodableObject.encodeToJSON() @@ -85,6 +88,12 @@ extension Date: JSONEncodable { } } +extension URL: JSONEncodable { + func encodeToJSON() -> Any { + return self + } +} + extension UUID: JSONEncodable { func encodeToJSON() -> Any { return self.uuidString @@ -113,24 +122,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeArray(_ values: [T], forKey key: Self.Key) throws where T : Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeArrayIfPresent(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap(_ pairs: [Self.Key: T]) throws where T : Encodable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeMap(_ pairs: [Self.Key: T]) throws where T : Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent(_ pairs: [Self.Key: T]?) throws where T : Encodable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeMapIfPresent(_ pairs: [Self.Key: T]?) throws where T : Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -140,7 +149,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeArray(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -152,7 +161,7 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeArrayIfPresent(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { var tmpArray: [T]? = nil if contains(key) { @@ -162,7 +171,7 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap(_ type: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T : Decodable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeMap(_ type: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T : Decodable { var map: [Self.Key : T] = [:] for key in allKeys { @@ -178,7 +187,7 @@ extension KeyedDecodingContainerProtocol { } {{#usePromiseKit}}extension RequestBuilder { - public func execute() -> Promise> { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func execute() -> Promise> { let deferred = Promise>.pending() self.execute { (response: Response?, error: Error?) in if let response = response { diff --git a/modules/openapi-generator/src/main/resources/swift4/JSONEncodableEncoding.mustache b/modules/openapi-generator/src/main/resources/swift4/JSONEncodableEncoding.mustache index ca05906d420..69636d84635 100644 --- a/modules/openapi-generator/src/main/resources/swift4/JSONEncodableEncoding.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/JSONEncodableEncoding.mustache @@ -8,7 +8,7 @@ import Foundation import Alamofire -public struct JSONDataEncoding: ParameterEncoding { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct JSONDataEncoding: ParameterEncoding { // MARK: Properties @@ -25,7 +25,7 @@ public struct JSONDataEncoding: ParameterEncoding { /// - throws: An `Error` if the encoding process encounters an error. /// /// - returns: The encoded request. - public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { var urlRequest = try urlRequest.asURLRequest() guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else { @@ -41,7 +41,7 @@ public struct JSONDataEncoding: ParameterEncoding { return urlRequest } - public static func encodingParameters(jsonData: Data?) -> Parameters? { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func encodingParameters(jsonData: Data?) -> Parameters? { var returnedParams: Parameters? = nil if let jsonData = jsonData, !jsonData.isEmpty { var params = Parameters() diff --git a/modules/openapi-generator/src/main/resources/swift4/JSONEncodingHelper.mustache b/modules/openapi-generator/src/main/resources/swift4/JSONEncodingHelper.mustache index 70449515842..d4d7cc8f750 100644 --- a/modules/openapi-generator/src/main/resources/swift4/JSONEncodingHelper.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/JSONEncodingHelper.mustache @@ -8,9 +8,9 @@ import Foundation import Alamofire -open class JSONEncodingHelper { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class JSONEncodingHelper { - open class func encodingParameters(forEncodableObject encodableObj: T?) -> Parameters? { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters(forEncodableObject encodableObj: T?) -> Parameters? { var params: Parameters? = nil // Encode the Encodable object @@ -24,7 +24,7 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?) -> Parameters? { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters(forEncodableObject encodableObj: Any?) -> Parameters? { var params: Parameters? = nil if let encodableObj = encodableObj { diff --git a/modules/openapi-generator/src/main/resources/swift4/Models.mustache b/modules/openapi-generator/src/main/resources/swift4/Models.mustache index 40856389035..62b20a27c32 100644 --- a/modules/openapi-generator/src/main/resources/swift4/Models.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/Models.mustache @@ -10,22 +10,22 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ErrorResponse : Error { case error(Int, Data?, Error) } -open class Response { - public let statusCode: Int - public let header: [String: String] - public let body: T? +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class Response { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let statusCode: Int + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let header: [String: String] + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let body: T? - public init(statusCode: Int, header: [String: String], body: T?) { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(statusCode: Int, header: [String: String], body: T?) { self.statusCode = statusCode self.header = header self.body = body } - public convenience init(response: HTTPURLResponse, body: T?) { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields var header = [String:String]() for case let (key, value) as (String, String) in rawHeader { diff --git a/modules/openapi-generator/src/main/resources/swift4/Result.mustache b/modules/openapi-generator/src/main/resources/swift4/Result.mustache new file mode 100644 index 00000000000..e4216be5509 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/swift4/Result.mustache @@ -0,0 +1,17 @@ +// +// Result.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +#if swift(<5) + +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum Result { + case success(Value) + case failure(Error) +} + +#endif diff --git a/modules/openapi-generator/src/main/resources/swift4/_param.mustache b/modules/openapi-generator/src/main/resources/swift4/_param.mustache index 5caacbc6005..770458343aa 100644 --- a/modules/openapi-generator/src/main/resources/swift4/_param.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/_param.mustache @@ -1 +1 @@ -"{{baseName}}": {{paramName}}{{^isEnum}}{{#isInteger}}{{^required}}?{{/required}}.encodeToJSON(){{/isInteger}}{{#isLong}}{{^required}}?{{/required}}.encodeToJSON(){{/isLong}}{{/isEnum}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}.rawValue{{/isContainer}}{{/isEnum}}{{#isDate}}{{^required}}?{{/required}}.encodeToJSON(){{/isDate}}{{#isDateTime}}{{^required}}?{{/required}}.encodeToJSON(){{/isDateTime}} \ No newline at end of file +"{{baseName}}": {{paramName}}{{^required}}?{{/required}}.encodeToJSON() \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift4/api.mustache b/modules/openapi-generator/src/main/resources/swift4/api.mustache index 813518bfb05..18eab9425a6 100644 --- a/modules/openapi-generator/src/main/resources/swift4/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/api.mustache @@ -5,8 +5,7 @@ // https://openapi-generator.tech // -import Foundation -import Alamofire{{#usePromiseKit}} +import Foundation{{#usePromiseKit}} import PromiseKit{{/usePromiseKit}}{{#useRxSwift}} import RxSwift{{/useRxSwift}} @@ -16,14 +15,14 @@ extension {{projectName}}API { {{#description}} /** {{description}} */{{/description}} -open class {{classname}} { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{classname}} { {{#operation}} {{#allParams}} {{#isEnum}} /** * enum for parameter {{paramName}} */ - public enum {{enumName}}_{{operationId}}: {{^isContainer}}{{{dataType}}}{{/isContainer}}{{#isContainer}}String{{/isContainer}} { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}_{{operationId}}: {{^isContainer}}{{{dataType}}}{{/isContainer}}{{#isContainer}}String{{/isContainer}} { {{#allowableValues}} {{#enumVars}} case {{name}} = {{{value}}} @@ -42,7 +41,7 @@ open class {{classname}} { - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} - parameter completion: completion handler to receive the data and the error objects */ - open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: @escaping ((_ data: {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}?,_ error: Error?) -> Void)) { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: @escaping ((_ data: {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}?,_ error: Error?) -> Void)) { {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).execute { (response, error) -> Void in {{#returnType}} completion(response?.body, error) @@ -66,7 +65,7 @@ open class {{classname}} { - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} - returns: Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> */ - open class func {{operationId}}({{#allParams}} {{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}} {{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { let deferred = Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.pending() {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).execute { (response, error) -> Void in if let error = error { @@ -94,7 +93,7 @@ open class {{classname}} { - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} - returns: Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> */ - open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { return Observable.create { observer -> Disposable in {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).execute { (response, error) -> Void in if let error = error { @@ -116,6 +115,33 @@ open class {{classname}} { } } {{/useRxSwift}} +{{#useResult}} + /** + {{#summary}} + {{{summary}}} + {{/summary}}{{#allParams}} + - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} + - parameter completion: completion handler to receive the result + */ + open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: @escaping ((_ result: Result<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>) -> Void)) { + {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + {{#returnType}} + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + {{/returnType}} + {{^returnType}} + } else { + completion(.success(())) + } + {{/returnType}} + } + } +{{/useResult}} /** {{#summary}} @@ -141,7 +167,7 @@ open class {{classname}} { {{/allParams}} - returns: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{description}} */ - open class func {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { {{^pathParams}}let{{/pathParams}}{{#pathParams}}{{^secondaryParam}}var{{/secondaryParam}}{{/pathParams}} path = "{{{path}}}"{{#pathParams}} let {{paramName}}PreEscape = "\({{#isEnum}}{{paramName}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}}{{^isEnum}}APIHelper.mapValueToPathItem({{paramName}}){{/isEnum}})" let {{paramName}}PostEscape = {{paramName}}PreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/modules/openapi-generator/src/main/resources/swift4/api_doc.mustache b/modules/openapi-generator/src/main/resources/swift4/api_doc.mustache index 9ea5ae16149..c08e36fa550 100644 --- a/modules/openapi-generator/src/main/resources/swift4/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/api_doc.mustache @@ -14,14 +14,14 @@ Method | HTTP request | Description ```swift {{^usePromiseKit}} {{^useRxSwift}} - open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: @escaping (_ data: {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void) + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: @escaping (_ data: {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void) {{/useRxSwift}} {{/usePromiseKit}} {{#usePromiseKit}} - open class func {{operationId}}({{#allParams}} {{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}} {{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{/usePromiseKit}} {{#useRxSwift}} - open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{/useRxSwift}} ``` diff --git a/modules/openapi-generator/src/main/resources/swift4/modelArray.mustache b/modules/openapi-generator/src/main/resources/swift4/modelArray.mustache index 843626158cd..536c5e9eea4 100644 --- a/modules/openapi-generator/src/main/resources/swift4/modelArray.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/modelArray.mustache @@ -1 +1 @@ -public typealias {{classname}} = {{parent}} \ No newline at end of file +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} typealias {{classname}} = {{parent}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift4/modelEnum.mustache b/modules/openapi-generator/src/main/resources/swift4/modelEnum.mustache index 91c2efd54af..4a28e656e2d 100644 --- a/modules/openapi-generator/src/main/resources/swift4/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/modelEnum.mustache @@ -1,4 +1,4 @@ -public enum {{classname}}: {{dataType}}, Codable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, Codable { {{#allowableValues}} {{#enumVars}} case {{name}} = {{{value}}} diff --git a/modules/openapi-generator/src/main/resources/swift4/modelInlineEnumDeclaration.mustache b/modules/openapi-generator/src/main/resources/swift4/modelInlineEnumDeclaration.mustache index e2a3d08e912..e7fed7d16ea 100644 --- a/modules/openapi-generator/src/main/resources/swift4/modelInlineEnumDeclaration.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/modelInlineEnumDeclaration.mustache @@ -1,4 +1,4 @@ - public enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Codable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Codable { {{#allowableValues}} {{#enumVars}} case {{name}} = {{{value}}} diff --git a/modules/openapi-generator/src/main/resources/swift4/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift4/modelObject.mustache index d477ac7880d..54ad96db65f 100644 --- a/modules/openapi-generator/src/main/resources/swift4/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/modelObject.mustache @@ -1,5 +1,5 @@ -public struct {{classname}}: Codable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct {{classname}}: Codable { {{#allVars}} {{#isEnum}} @@ -9,12 +9,12 @@ public struct {{classname}}: Codable { {{#allVars}} {{#isEnum}} {{#description}}/** {{description}} */ - {{/description}}public var {{name}}: {{{datatypeWithEnum}}}{{#unwrapRequired}}?{{/unwrapRequired}}{{^unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} + {{/description}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var {{name}}: {{{datatypeWithEnum}}}{{#unwrapRequired}}?{{/unwrapRequired}}{{^unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} {{/isEnum}} {{^isEnum}} {{#description}}/** {{description}} */ - {{/description}}public var {{name}}: {{{datatype}}}{{#unwrapRequired}}?{{/unwrapRequired}}{{^unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#objcCompatible}}{{#vendorExtensions.x-swift-optional-scalar}} - public var {{name}}Num: NSNumber? { + {{/description}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var {{name}}: {{{datatype}}}{{#unwrapRequired}}?{{/unwrapRequired}}{{^unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#objcCompatible}}{{#vendorExtensions.x-swift-optional-scalar}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var {{name}}Num: NSNumber? { get { return {{name}}.map({ return NSNumber(value: $0) }) } @@ -23,16 +23,16 @@ public struct {{classname}}: Codable { {{/allVars}} {{#hasVars}} - public init({{#allVars}}{{name}}: {{{datatypeWithEnum}}}{{#unwrapRequired}}?{{/unwrapRequired}}{{^unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}{{#hasMore}}, {{/hasMore}}{{/allVars}}) { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init({{#allVars}}{{name}}: {{{datatypeWithEnum}}}{{#unwrapRequired}}?{{/unwrapRequired}}{{^unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}{{#hasMore}}, {{/hasMore}}{{/allVars}}) { {{#allVars}} self.{{name}} = {{name}} {{/allVars}} } {{/hasVars}} {{#additionalPropertiesType}} - public var additionalProperties: [String:{{{additionalPropertiesType}}}] = [:] + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var additionalProperties: [String:{{{additionalPropertiesType}}}] = [:] - public subscript(key: String) -> {{{additionalPropertiesType}}}? { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} subscript(key: String) -> {{{additionalPropertiesType}}}? { get { if let value = additionalProperties[key] { return value @@ -47,7 +47,7 @@ public struct {{classname}}: Codable { // Encodable protocol methods - public func encode(to encoder: Encoder) throws { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: String.self) @@ -59,7 +59,7 @@ public struct {{classname}}: Codable { // Decodable protocol methods - public init(from decoder: Decoder) throws { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: String.self) {{#allVars}} @@ -74,7 +74,7 @@ public struct {{classname}}: Codable { {{/additionalPropertiesType}} {{^additionalPropertiesType}}{{#vendorExtensions.x-codegen-has-escaped-property-names}} - public enum CodingKeys: String, CodingKey { {{#allVars}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum CodingKeys: String, CodingKey { {{#allVars}} case {{name}}{{#vendorExtensions.x-codegen-escaped-property-name}} = "{{{baseName}}}"{{/vendorExtensions.x-codegen-escaped-property-name}}{{/allVars}} } {{/vendorExtensions.x-codegen-has-escaped-property-names}}{{/additionalPropertiesType}} diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache index 28d21d1e299..7ab6c76bb2e 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache @@ -385,15 +385,25 @@ export class {{classname}} { {{/hasFormParams}} {{#useHttpClient}} + {{^isResponseFile}} + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + + {{/isResponseFile}} return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.configuration.basePath}{{{path}}}`,{{#isBodyAllowed}} {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}} { -{{#hasQueryParams}} + {{#hasQueryParams}} params: queryParameters, -{{/hasQueryParams}} -{{#isResponseFile}} + {{/hasQueryParams}} + {{#isResponseFile}} responseType: "blob", -{{/isResponseFile}} + {{/isResponseFile}} + {{^isResponseFile}} + responseType: responseType, + {{/isResponseFile}} withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -414,6 +424,9 @@ export class {{classname}} { {{#isResponseFile}} responseType: ResponseContentType.Blob, {{/isResponseFile}} +{{^isResponseFile}} + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, +{{/isResponseFile}} {{#hasQueryParams}} search: queryParameters, {{/hasQueryParams}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache index 03e1f986f12..29957247033 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache @@ -275,7 +275,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -283,7 +283,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -291,7 +291,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -299,7 +299,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache b/modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache index 8ecab671c21..922a654f44b 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache @@ -7,9 +7,9 @@ import http = require('http'); import { {{classname}} } from '../{{filename}}'; {{/imports}} -import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; +import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; {{#hasAuthMethods}} -import { HttpBasicAuth, ApiKeyAuth, OAuth } from '../model/models'; +import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; {{/hasAuthMethods}} import { HttpError, RequestFile } from './apis'; @@ -43,9 +43,12 @@ export class {{classname}} { 'default': new VoidAuth(), {{#hasAuthMethods}} {{#authMethods}} -{{#isBasic}} +{{#isBasicBasic}} '{{name}}': new HttpBasicAuth(), -{{/isBasic}} +{{/isBasicBasic}} +{{#isBasicBearer}} + '{{name}}': new HttpBearerAuth(), +{{/isBasicBearer}} {{#isApiKey}} '{{name}}': new ApiKeyAuth({{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}}{{#isKeyInCookie}}'cookie'{{/isKeyInCookie}}, '{{keyParamName}}'), {{/isApiKey}} @@ -56,19 +59,21 @@ export class {{classname}} { {{/hasAuthMethods}} } + protected interceptors: Interceptor[] = []; + constructor(basePath?: string); {{#authMethods}} -{{#isBasic}} +{{#isBasicBasic}} constructor(username: string, password: string, basePath?: string); -{{/isBasic}} +{{/isBasicBasic}} {{/authMethods}} constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { {{#authMethods}} -{{#isBasic}} +{{#isBasicBasic}} this.username = basePathOrUsername; this.password = password -{{/isBasic}} +{{/isBasicBasic}} {{/authMethods}} if (basePath) { this.basePath = basePath; @@ -101,7 +106,8 @@ export class {{classname}} { } {{#hasAuthMethods}} {{#authMethods}} -{{#isBasic}} +{{#isBasicBasic}} + set username(username: string) { this.authentications.{{name}}.username = username; } @@ -109,7 +115,13 @@ export class {{classname}} { set password(password: string) { this.authentications.{{name}}.password = password; } -{{/isBasic}} +{{/isBasicBasic}} +{{#isBasicBearer}} + + set accessToken(accessToken: string | (() => string)) { + this.authentications.{{name}}.accessToken = accessToken; + } +{{/isBasicBearer}} {{#isOAuth}} set accessToken(token: string) { @@ -119,6 +131,10 @@ export class {{classname}} { {{/authMethods}} {{/hasAuthMethods}} + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + {{#operation}} /** * {{¬es}} @@ -204,7 +220,13 @@ export class {{classname}} { {{/authMethods}} authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; diff --git a/modules/openapi-generator/src/main/resources/typescript-node/model.mustache b/modules/openapi-generator/src/main/resources/typescript-node/model.mustache index 3559593a50c..c3b8119ec68 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/model.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/model.mustache @@ -18,7 +18,7 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ * {{{description}}} */ {{/description}} - '{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}; + '{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; {{/vars}} {{#discriminator}} @@ -48,7 +48,7 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ return {{classname}}.attributeTypeMap; {{/parent}} } - {{/isArrayModel}} + {{/isArrayModel}} } {{#hasEnums}} diff --git a/modules/openapi-generator/src/main/resources/typescript-node/models.mustache b/modules/openapi-generator/src/main/resources/typescript-node/models.mustache index 963faeb2294..f129eb63e78 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/models.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/models.mustache @@ -180,6 +180,19 @@ export class HttpBasicAuth implements Authentication { } } +export class HttpBearerAuth implements Authentication { + public accessToken: string | (() => string) = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + const accessToken = typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + requestOptions.headers["Authorization"] = "Bearer " + accessToken; + } + } +} + export class ApiKeyAuth implements Authentication { public apiKey: string = ''; @@ -219,4 +232,6 @@ export class VoidAuth implements Authentication { applyToRequest(_: localVarRequest.Options): void { // Do nothing } -} \ No newline at end of file +} + +export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise | void); diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/modelAllOf.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/modelAllOf.mustache new file mode 100644 index 00000000000..2c4f686eacb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/modelAllOf.mustache @@ -0,0 +1,14 @@ +{{#hasImports}} +import { + {{#imports}} + {{{.}}}, + {{/imports}} +} from './'; + +{{/hasImports}} +/** + * @type {{classname}}{{#description}} + * {{{description}}}{{/description}} + * @export + */ +export type {{classname}} = {{#allOf}}{{{.}}}{{^-last}} & {{/-last}}{{/allOf}}; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/models.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/models.mustache index ae5738af984..6f5fe539ee4 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/models.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/models.mustache @@ -2,6 +2,6 @@ {{>licenseInfo}} {{#models}} {{#model}} -{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{^isEnum}}{{^oneOf}}{{>modelGeneric}}{{/oneOf}}{{/isEnum}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{#allOf}}{{#-first}}{{>modelAllOf}}{{/-first}}{{/allOf}}{{^isEnum}}{{^oneOf}}{{^allOf}}{{>modelGeneric}}{{/allOf}}{{/oneOf}}{{/isEnum}} {{/model}} {{/models}} 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 4221086015c..0f25bf02e8c 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 @@ -268,6 +268,41 @@ public class DefaultCodegenTest { Assert.assertEquals(type, "oneOf"); } + @Test + public void testComposedSchemaOneOfWithProperties() { + final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/oneOf.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + + final Schema schema = openAPI.getComponents().getSchemas().get("fruit"); + codegen.setOpenAPI(openAPI); + CodegenModel fruit = codegen.fromModel("Fruit", schema); + + Set oneOf = new TreeSet(); + oneOf.add("Apple"); + oneOf.add("Banana"); + Assert.assertEquals(fruit.oneOf, oneOf); + Assert.assertEquals(fruit.optionalVars.size(), 3); + Assert.assertEquals(fruit.vars.size(), 3); + // make sure that fruit has the property color + boolean colorSeen = false; + for (CodegenProperty cp : fruit.vars) { + if (cp.name.equals("color")) { + colorSeen = true; + break; + } + } + Assert.assertTrue(colorSeen); + colorSeen = false; + for (CodegenProperty cp : fruit.optionalVars) { + if (cp.name.equals("color")) { + colorSeen = true; + break; + } + } + Assert.assertTrue(colorSeen); + } + + @Test public void testEscapeText() { final DefaultCodegen codegen = new DefaultCodegen(); @@ -450,6 +485,7 @@ public class DefaultCodegenTest { CodegenDiscriminator discriminator = animalModel.getDiscriminator(); CodegenDiscriminator test = new CodegenDiscriminator(); test.setPropertyName("className"); + test.setPropertyBaseName("className"); test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Dog", "Dog")); test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Cat", "Cat")); Assert.assertEquals(discriminator, test); @@ -804,6 +840,7 @@ public class DefaultCodegenTest { private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) { CodegenDiscriminator test = new CodegenDiscriminator(); test.setPropertyName("DollarUnderscoretype"); + test.setPropertyBaseName("$_type"); test.setMapping(new HashMap<>()); test.getMapping().put("a", "#/components/schemas/Adult"); test.getMapping().put("c", "Child"); @@ -1076,4 +1113,55 @@ public class DefaultCodegenTest { Assert.assertFalse(result); } } + + @Test + public void testCircularReferencesDetection() { + // given + DefaultCodegen codegen = new DefaultCodegen(); + final CodegenProperty inboundOut = new CodegenProperty(); + inboundOut.baseName = "out"; + inboundOut.dataType = "RoundA"; + final CodegenProperty roundANext = new CodegenProperty(); + roundANext.baseName = "next"; + roundANext.dataType = "RoundB"; + final CodegenProperty roundBNext = new CodegenProperty(); + roundBNext.baseName = "next"; + roundBNext.dataType = "RoundC"; + final CodegenProperty roundCNext = new CodegenProperty(); + roundCNext.baseName = "next"; + roundCNext.dataType = "RoundA"; + final CodegenProperty roundCOut = new CodegenProperty(); + roundCOut.baseName = "out"; + roundCOut.dataType = "Outbound"; + final CodegenModel inboundModel = new CodegenModel(); + inboundModel.setDataType("Inbound"); + inboundModel.setAllVars(Collections.singletonList(inboundOut)); + final CodegenModel roundAModel = new CodegenModel(); + roundAModel.setDataType("RoundA"); + roundAModel.setAllVars(Collections.singletonList(roundANext)); + final CodegenModel roundBModel = new CodegenModel(); + roundBModel.setDataType("RoundB"); + roundBModel.setAllVars(Collections.singletonList(roundBNext)); + final CodegenModel roundCModel = new CodegenModel(); + roundCModel.setDataType("RoundC"); + roundCModel.setAllVars(Arrays.asList(roundCNext, roundCOut)); + final CodegenModel outboundModel = new CodegenModel(); + outboundModel.setDataType("Outbound"); + final Map models = new HashMap<>(); + models.put("Inbound", inboundModel); + models.put("RoundA", roundAModel); + models.put("RoundB", roundBModel); + models.put("RoundC", roundCModel); + models.put("Outbound", outboundModel); + + // when + codegen.setCircularReferences(models); + + // then + Assert.assertFalse(inboundOut.isCircularReference); + Assert.assertTrue(roundANext.isCircularReference); + Assert.assertTrue(roundBNext.isCircularReference); + Assert.assertTrue(roundCNext.isCircularReference); + Assert.assertFalse(roundCOut.isCircularReference); + } } 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 e8097915a0f..46449c74a3a 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 @@ -1,19 +1,25 @@ package org.openapitools.codegen; +import io.swagger.models.Response; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.Paths; import io.swagger.v3.oas.models.media.IntegerSchema; +import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.parameters.Parameter; 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 org.openapitools.codegen.utils.ModelUtils; import org.testng.Assert; import org.testng.annotations.Test; import java.io.File; import java.io.IOException; +import java.util.HashSet; import java.util.List; import java.util.Map; @@ -74,6 +80,48 @@ public class DefaultGeneratorTest { Assert.assertEquals(defaultList.get(1).allParams.size(), 1); } + @Test + public void testRefModelValidationProperties(){ + OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/2_0/refAliasedPrimitiveWithValidation.yml"); + ClientOptInput opts = new ClientOptInput(); + opts.setOpenAPI(openAPI); + DefaultCodegen config = new DefaultCodegen(); + config.setStrictSpecBehavior(false); + opts.setConfig(config); + + DefaultGenerator generator = new DefaultGenerator(); + generator.opts(opts); + + String expectedPattern = "^\\d{3}-\\d{2}-\\d{4}$"; + // NOTE: double-escaped regex for when the value is intended to be dumped in template into a String location. + String escapedPattern = config.toRegularExpression(expectedPattern); + + Schema stringRegex = openAPI.getComponents().getSchemas().get("StringRegex"); + // Sanity check. + Assert.assertEquals(stringRegex.getPattern(), expectedPattern); + + // Validate when we alias/unalias + Schema unaliasedStringRegex = ModelUtils.unaliasSchema(openAPI, stringRegex); + Assert.assertEquals(unaliasedStringRegex.getPattern(), expectedPattern); + + // Validate when converting to property + CodegenProperty stringRegexProperty = config.fromProperty("stringRegex", stringRegex); + Assert.assertEquals(stringRegexProperty.pattern, escapedPattern); + + // Validate when converting to parameter + Operation operation = openAPI.getPaths().get("/fake/StringRegex").getPost(); + RequestBody body = operation.getRequestBody(); + CodegenParameter codegenParameter = config.fromRequestBody(body, new HashSet<>(), "body"); + + Assert.assertEquals(codegenParameter.pattern, escapedPattern); + + // Validate when converting to response + ApiResponse response = operation.getResponses().get("200"); + CodegenResponse codegenResponse = config.fromResponse("200", response); + + Assert.assertEquals(((Schema)codegenResponse.schema).getPattern(), expectedPattern); + Assert.assertEquals(codegenResponse.pattern, escapedPattern); + } @Test public void minimalUpdateTest() throws IOException { 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 6c1d9a12b1f..9f970a6597d 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,6 @@ package org.openapitools.codegen; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.fail; import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertFalse; @@ -104,4 +105,27 @@ public class TestUtils { fail("Java parse problem: " + filename, ex); } } + + + public static void assertFileContains(MockDefaultGenerator generator, String path, String... lines) { + final String generatedFile = generator.getFiles().get(path); + if (null == generatedFile) { + fail("File " + path + " not found in " + generator.getFiles().keySet()); + } + String file = linearize(generatedFile); + assertNotNull(file); + for (String line : lines) + assertTrue(file.contains(linearize(line))); + } + + private static String linearize(String target) { + return target.replaceAll("\r?\n", "").replaceAll("\\s+", "\\s"); + } + + public static void assertFileNotContains(MockDefaultGenerator generator, String path, String... lines) { + String file = linearize(generator.getFiles().get(path)); + assertNotNull(file); + for (String line : lines) + assertFalse(file.contains(linearize(line))); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocSampleGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocSampleGeneratorTest.java index f903d74d79c..73fa7803d4c 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocSampleGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocSampleGeneratorTest.java @@ -64,6 +64,7 @@ public class AsciidocSampleGeneratorTest { /** * ensure api-docs.json includes sample and spec files directory as attributes. + * @throws Exception exception */ @Test public void testSampleAsciidocMarkupGenerationFromJsonWithAttributes() throws Exception { @@ -75,6 +76,7 @@ public class AsciidocSampleGeneratorTest { /** * ensure api-docs.json includes sample and spec files into markup. + * @throws Exception exception */ @Test public void testSampleAsciidocMarkupGenerationFromJsonWithIncludes() throws Exception { @@ -98,6 +100,7 @@ public class AsciidocSampleGeneratorTest { /** * markup doc header content. + * @throws Exception exception */ @Test public void testSampleAsciidocMarkupGenerationFromJsonWithContent() throws Exception { @@ -108,6 +111,7 @@ public class AsciidocSampleGeneratorTest { /** * fix: parameter name unchanged. + * @throws Exception exception */ @Test public void testSampleAsciidocMarkupGenerationParameterNameUnchanged() throws Exception { @@ -117,6 +121,7 @@ public class AsciidocSampleGeneratorTest { /** * added apikey info in access section. + * @throws Exception exception */ @Test public void testSampleAsciidocMarkupGenerationAccessApiKey() throws Exception { @@ -130,6 +135,7 @@ public class AsciidocSampleGeneratorTest { /** * no form params in this sample spec. + * @throws Exception exception */ @Test public void testSampleAsciidocMarkupGenerationWithoutFormParameter() throws Exception { 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 2f8a8d31c9b..aa11a462ca0 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 @@ -491,6 +491,26 @@ public class JavaClientCodegenTest { assertEquals(postScopes.size(), 2, "POST scopes don't match. actual:" + postScopes); } + @Test + public void testAuthorizationsHasMoreWhenFiltered() { + final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/issue4584.yaml"); + + final DefaultGenerator defaultGenerator = new DefaultGenerator(); + + final ClientOptInput clientOptInput = new ClientOptInput(); + clientOptInput.setOpenAPI(openAPI); + clientOptInput.setConfig(new JavaClientCodegen()); + + defaultGenerator.opts(clientOptInput); + final List codegenOperations = defaultGenerator.processPaths(openAPI.getPaths()).get("Pet"); + + final CodegenOperation getCodegenOperation = codegenOperations.stream().filter(it -> it.httpMethod.equals("GET")).collect(Collectors.toList()).get(0); + assertTrue(getCodegenOperation.hasAuthMethods); + assertEquals(getCodegenOperation.authMethods.size(), 2); + assertTrue(getCodegenOperation.authMethods.get(0).hasMore); + Assert.assertFalse(getCodegenOperation.authMethods.get(1).hasMore); + } + @Test public void testFreeFormObjects() { final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/issue796.yaml"); 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 0b782aa3c4e..ca580b8a75d 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 @@ -14,9 +14,8 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; +import static org.openapitools.codegen.TestUtils.assertFileContains; +import static org.openapitools.codegen.TestUtils.assertFileNotContains; public abstract class JavaJaxrsBaseTest { @@ -34,9 +33,9 @@ public abstract class JavaJaxrsBaseTest { codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); - ClientOptInput input = new ClientOptInput(); - input.setOpenAPI(openAPI); - input.setConfig(codegen); + ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -47,19 +46,9 @@ public abstract class JavaJaxrsBaseTest { " @JsonSubTypes.Type(value = Dog.class, name = \"Dog\"),\n" + " @JsonSubTypes.Type(value = Cat.class, name = \"Cat\"),\n" + "})"; - checkFileContains(generator, outputPath + "/src/gen/java/org/openapitools/model/Animal.java", jsonTypeInfo, jsonSubType); + assertFileContains(generator, outputPath + "/src/gen/java/org/openapitools/model/Animal.java", jsonTypeInfo, jsonSubType); } - private void checkFileContains(MockDefaultGenerator generator, String path, String... lines) { - String file = linearize(generator.getFiles().get(path)); - assertNotNull(file); - for (String line : lines) - assertTrue(file.contains(linearize(line))); - } - - private String linearize(String target) { - return target.replaceAll("\r?\n", "").replaceAll("\\s+", "\\s"); - } @Test public void doNotGenerateJsonAnnotationForPolymorphismIfJsonExclude() throws IOException { @@ -74,9 +63,9 @@ public abstract class JavaJaxrsBaseTest { codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); - ClientOptInput input = new ClientOptInput(); - input.setOpenAPI(openAPI); - input.setConfig(codegen); + ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -87,15 +76,9 @@ public abstract class JavaJaxrsBaseTest { " @JsonSubTypes.Type(value = Dog.class, name = \"Dog\"),\n" + " @JsonSubTypes.Type(value = Cat.class, name = \"Cat\"),\n" + "})"; - checkFileNotContains(generator, outputPath + "/src/gen/java/org/openapitools/model/Animal.java", jsonTypeInfo, jsonSubType); + assertFileNotContains(generator, outputPath + "/src/gen/java/org/openapitools/model/Animal.java", jsonTypeInfo, jsonSubType); } - private void checkFileNotContains(MockDefaultGenerator generator, String path, String... lines) { - String file = linearize(generator.getFiles().get(path)); - assertNotNull(file); - for (String line : lines) - assertFalse(file.contains(linearize(line))); - } @Test public void doNotAddDefaultValueDocumentationForContainers() throws IOException { @@ -109,14 +92,14 @@ public abstract class JavaJaxrsBaseTest { codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); - ClientOptInput input = new ClientOptInput(); - input.setOpenAPI(openAPI); - input.setConfig(codegen); + ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); - checkFileNotContains(generator, outputPath + "/src/gen/java/org/openapitools/api/ExamplesApi.java", "DefaultValue"); + assertFileNotContains(generator, outputPath + "/src/gen/java/org/openapitools/api/ExamplesApi.java", "DefaultValue"); } @Test @@ -133,13 +116,13 @@ public abstract class JavaJaxrsBaseTest { codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); - ClientOptInput input = new ClientOptInput(); - input.setOpenAPI(openAPI); - input.setConfig(codegen); + ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); - checkFileContains(generator, outputPath + "/src/gen/java/org/openapitools/api/ExamplesApi.java", "DefaultValue"); + assertFileContains(generator, outputPath + "/src/gen/java/org/openapitools/api/ExamplesApi.java", "DefaultValue"); } } 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 378f7e5d8e0..1febdfe86ee 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 @@ -34,6 +34,8 @@ import org.testng.annotations.Test; import java.io.File; import java.io.IOException; import java.nio.file.Files; +import java.util.Map; +import java.util.stream.Collectors; import static java.util.stream.Collectors.groupingBy; import static org.openapitools.codegen.languages.SpringCodegen.RESPONSE_WRAPPER; @@ -41,9 +43,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; -import static org.openapitools.codegen.languages.SpringCodegen.RESPONSE_WRAPPER; -import static org.testng.Assert.assertTrue; - public class SpringCodegenTest { @Test @@ -248,6 +247,74 @@ public class SpringCodegenTest { "@RequestParam(value = \"start\""); } + // Helper function, intended to reduce boilerplate + private Map generateFiles(SpringCodegen codegen, String filePath) throws IOException { + final File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + final String outputPath = output.getAbsolutePath().replace('\\', '/'); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + + final ClientOptInput input = new ClientOptInput(); + final OpenAPI openAPI = new OpenAPIParser().readLocation(filePath, null, new ParseOptions()).getOpenAPI(); + input.openAPI(openAPI); + input.config(codegen); + + final MockDefaultGenerator generator = new MockDefaultGenerator(); + generator.opts(input).generate(); + + return generator.getFiles().entrySet().stream().collect(Collectors.toMap(e -> e.getKey().replace(outputPath, ""), Map.Entry::getValue)); + } + + @Test + public void testMultipartBoot() throws IOException { + final SpringCodegen codegen = new SpringCodegen(); + codegen.setLibrary("spring-boot"); + codegen.setDelegatePattern(true); + + final Map files = generateFiles(codegen, "src/test/resources/3_0/form-multipart-binary-array.yaml"); + + // Check that the delegate handles the array + final String multipartArrayApiDelegate = files.get("/src/main/java/org/openapitools/api/MultipartArrayApiDelegate.java"); + Assert.assertTrue(multipartArrayApiDelegate.contains("List files")); + + // Check that the api handles the array + final String multipartArrayApi = files.get("/src/main/java/org/openapitools/api/MultipartArrayApi.java"); + Assert.assertTrue(multipartArrayApi.contains("List files")); + Assert.assertTrue(multipartArrayApi.contains("@ApiParam(value = \"Many files\")")); + Assert.assertTrue(multipartArrayApi.contains("@RequestPart(\"files\")")); + + // Check that the delegate handles the single file + final String multipartSingleApiDelegate = files.get("/src/main/java/org/openapitools/api/MultipartSingleApiDelegate.java"); + Assert.assertTrue(multipartSingleApiDelegate.contains("MultipartFile file")); + + // Check that the api handles the single file + final String multipartSingleApi = files.get("/src/main/java/org/openapitools/api/MultipartSingleApi.java"); + Assert.assertTrue(multipartSingleApi.contains("MultipartFile file")); + Assert.assertTrue(multipartSingleApi.contains("@ApiParam(value = \"One file\")")); + Assert.assertTrue(multipartSingleApi.contains("@RequestPart(\"file\")")); + } + + @Test + public void testMultipartCloud() throws IOException { + final SpringCodegen codegen = new SpringCodegen(); + codegen.setLibrary("spring-cloud"); + codegen.setDelegatePattern(true); + + final Map files = generateFiles(codegen, "src/test/resources/3_0/form-multipart-binary-array.yaml"); + + // Check that the delegate handles the array and the file + final String multipartApiDelegate = files.get("/src/main/java/org/openapitools/api/MultipartApiDelegate.java"); + Assert.assertTrue(multipartApiDelegate.contains("List files")); + Assert.assertTrue(multipartApiDelegate.contains("MultipartFile file")); + + // Check that the api handles the array and the file + final String multipartApi = files.get("/src/main/java/org/openapitools/api/MultipartApi.java"); + Assert.assertTrue(multipartApi.contains("List files")); + Assert.assertTrue(multipartApi.contains("MultipartFile file")); + } + @Test public void doGenerateRequestParamForSimpleParam() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinModelCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinModelCodegenTest.java new file mode 100644 index 00000000000..5975d0a5622 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinModelCodegenTest.java @@ -0,0 +1,72 @@ +package org.openapitools.codegen.kotlin; + +import io.swagger.parser.OpenAPIParser; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.parser.core.models.ParseOptions; +import org.openapitools.codegen.ClientOptInput; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.MockDefaultGenerator; +import org.openapitools.codegen.languages.AbstractKotlinCodegen; +import org.openapitools.codegen.languages.KotlinClientCodegen; +import org.openapitools.codegen.languages.KotlinServerCodegen; +import org.openapitools.codegen.languages.KotlinSpringServerCodegen; +import org.openapitools.codegen.languages.KotlinVertxServerCodegen; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + +import static org.openapitools.codegen.TestUtils.assertFileContains; + +public class KotlinModelCodegenTest { + + @DataProvider(name = "generators") + public Object[][] client() { + return new Object[][]{ + {new KotlinClientCodegen()}, + {new KotlinServerCodegen()}, + {new KotlinSpringServerCodegen()}, + {new KotlinVertxServerCodegen()}, + }; + } + + @Test(dataProvider = "generators") + public void modelAsValues(AbstractKotlinCodegen codegen) throws IOException { + String classNameProp = "val className"; + String colorProp = "val color"; + + checkModel(codegen, false, classNameProp, colorProp); + } + + @Test(dataProvider = "generators") + private void modelMutable(AbstractKotlinCodegen codegen) throws IOException { + String classNameProp = "var className"; + String colorProp = "var color"; + + checkModel(codegen, true, classNameProp, colorProp); + } + + private void checkModel(AbstractKotlinCodegen codegen, boolean mutable, String... props) 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/generic.yaml", null, new ParseOptions()).getOpenAPI(); + codegen.setOutputDir(output.getAbsolutePath()); + + codegen.additionalProperties().put(CodegenConstants.MODEL_PACKAGE, "models"); + codegen.additionalProperties().put(AbstractKotlinCodegen.MODEL_MUTABLE, mutable); + + ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); + + MockDefaultGenerator generator = new MockDefaultGenerator(); + generator.opts(input).generate(); + + assertFileContains(generator, outputPath + "/src/main/kotlin/models/Animal.kt", props); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift4OptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift4OptionsProvider.java index eba12dbcb27..29692ce08e3 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift4OptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift4OptionsProvider.java @@ -28,6 +28,7 @@ public class Swift4OptionsProvider implements OptionsProvider { public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String PROJECT_NAME_VALUE = "Swagger"; public static final String RESPONSE_AS_VALUE = "test"; + public static final String NON_PUBLIC_API_REQUIRED_VALUE = "false"; public static final String UNWRAP_REQUIRED_VALUE = "true"; public static final String OBJC_COMPATIBLE_VALUE = "false"; public static final String LENIENT_TYPE_CAST_VALUE = "false"; @@ -59,6 +60,7 @@ public class Swift4OptionsProvider implements OptionsProvider { .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(Swift4Codegen.PROJECT_NAME, PROJECT_NAME_VALUE) .put(Swift4Codegen.RESPONSE_AS, RESPONSE_AS_VALUE) + .put(CodegenConstants.NON_PUBLIC_API, NON_PUBLIC_API_REQUIRED_VALUE) .put(Swift4Codegen.UNWRAP_REQUIRED, UNWRAP_REQUIRED_VALUE) .put(Swift4Codegen.OBJC_COMPATIBLE, OBJC_COMPATIBLE_VALUE) .put(Swift4Codegen.LENIENT_TYPE_CAST, LENIENT_TYPE_CAST_VALUE) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4ModelEnumTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4ModelEnumTest.java index 9dc34cf3261..7991c70d990 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4ModelEnumTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4ModelEnumTest.java @@ -18,6 +18,8 @@ package org.openapitools.codegen.swift4; import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.media.IntegerSchema; +import io.swagger.v3.oas.models.media.NumberSchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; import org.openapitools.codegen.CodegenModel; @@ -28,12 +30,13 @@ import org.openapitools.codegen.languages.Swift4Codegen; import org.testng.Assert; import org.testng.annotations.Test; +import java.math.BigDecimal; import java.util.Arrays; @SuppressWarnings("static-method") public class Swift4ModelEnumTest { - @Test(description = "convert a java model with an enum and a default value") - public void converterTest() { + @Test(description = "convert a java model with an string enum and a default value") + public void convertStringDefaultValueTest() { final StringSchema enumSchema = new StringSchema(); enumSchema.setEnum(Arrays.asList("VALUE1", "VALUE2", "VALUE3")); enumSchema.setDefault("VALUE2"); @@ -51,8 +54,80 @@ public class Swift4ModelEnumTest { Assert.assertEquals(enumVar.dataType, "String"); Assert.assertEquals(enumVar.datatypeWithEnum, "Name"); Assert.assertEquals(enumVar.name, "name"); - Assert.assertEquals(enumVar.defaultValue, ".VALUE2"); + Assert.assertEquals(enumVar.defaultValue, ".value2"); Assert.assertEquals(enumVar.baseType, "String"); Assert.assertTrue(enumVar.isEnum); } + + @Test(description = "convert a java model with an reserved word string enum and a default value") + public void convertReservedWordStringDefaultValueTest() { + final StringSchema enumSchema = new StringSchema(); + enumSchema.setEnum(Arrays.asList("1st", "2nd", "3rd")); + enumSchema.setDefault("2nd"); + final Schema model = new Schema().type("object").addProperties("name", enumSchema); + + final DefaultCodegen codegen = new Swift4Codegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty enumVar = cm.vars.get(0); + Assert.assertEquals(enumVar.baseName, "name"); + Assert.assertEquals(enumVar.dataType, "String"); + Assert.assertEquals(enumVar.datatypeWithEnum, "Name"); + Assert.assertEquals(enumVar.name, "name"); + Assert.assertEquals(enumVar.defaultValue, "._2nd"); + Assert.assertEquals(enumVar.baseType, "String"); + Assert.assertTrue(enumVar.isEnum); + } + + @Test(description = "convert a java model with an integer enum and a default value") + public void convertIntegerDefaultValueTest() { + final IntegerSchema enumSchema = new IntegerSchema(); + enumSchema.setEnum(Arrays.asList(1, 2, 3)); + enumSchema.setDefault(2); + final Schema model = new Schema().type("object").addProperties("name", enumSchema); + + final DefaultCodegen codegen = new Swift4Codegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty enumVar = cm.vars.get(0); + Assert.assertEquals(enumVar.baseName, "name"); + Assert.assertEquals(enumVar.dataType, "Int"); + Assert.assertEquals(enumVar.datatypeWithEnum, "Name"); + Assert.assertEquals(enumVar.name, "name"); + Assert.assertEquals(enumVar.defaultValue, "._2"); + Assert.assertEquals(enumVar.baseType, "Int"); + Assert.assertTrue(enumVar.isEnum); + } + + @Test(description = "convert a java model with an number enum and a default value") + public void convertNumberDefaultValueTest() { + final NumberSchema enumSchema = new NumberSchema(); + enumSchema.setEnum(Arrays.asList(new BigDecimal(10), new BigDecimal(100), new BigDecimal(1000))); + enumSchema.setDefault(new BigDecimal((100))); + final Schema model = new Schema().type("object").addProperties("name", enumSchema); + + final DefaultCodegen codegen = new Swift4Codegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty enumVar = cm.vars.get(0); + Assert.assertEquals(enumVar.baseName, "name"); + Assert.assertEquals(enumVar.dataType, "Double"); + Assert.assertEquals(enumVar.datatypeWithEnum, "Name"); + Assert.assertEquals(enumVar.name, "name"); + Assert.assertEquals(enumVar.defaultValue, "._100"); + Assert.assertEquals(enumVar.baseType, "Double"); + Assert.assertTrue(enumVar.isEnum); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4OptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4OptionsTest.java index 0611790b326..c31fa7e62b1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4OptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4OptionsTest.java @@ -48,6 +48,8 @@ public class Swift4OptionsTest extends AbstractOptionsTest { times = 1; clientCodegen.setResponseAs(Swift4OptionsProvider.RESPONSE_AS_VALUE.split(",")); times = 1; + clientCodegen.setNonPublicApi(Boolean.valueOf(Swift4OptionsProvider.NON_PUBLIC_API_REQUIRED_VALUE)); + times = 1; clientCodegen.setUnwrapRequired(Boolean.valueOf(Swift4OptionsProvider.UNWRAP_REQUIRED_VALUE)); times = 1; clientCodegen.setObjcCompatible(Boolean.valueOf(Swift4OptionsProvider.OBJC_COMPATIBLE_VALUE)); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeModelTest.java index d3a11b970c0..efc0d377b92 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeModelTest.java @@ -18,9 +18,11 @@ package org.openapitools.codegen.typescript.typescriptnode; import com.google.common.collect.Sets; + import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.media.*; import io.swagger.v3.parser.util.SchemaTypeUtil; + import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.CodegenProperty; import org.openapitools.codegen.DefaultCodegen; @@ -206,6 +208,54 @@ public class TypeScriptNodeModelTest { Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); } + @Test(description = "convert an array additional properties model") + public void arrayModelAdditionalPropertiesArrayTest() { + final Schema schema = new Schema() + .description("a map model") + .additionalProperties(new ArraySchema().type("array").items(new Schema().type("string"))); + final DefaultCodegen codegen = new TypeScriptNodeClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a map model"); + Assert.assertEquals(cm.additionalPropertiesType, "Array"); + } + + @Test(description = "convert an string additional properties model") + public void arrayModelAdditionalPropertiesStringTest() { + final Schema schema = new Schema() + .description("a map model") + .additionalProperties(new Schema().type("string")); + final DefaultCodegen codegen = new TypeScriptNodeClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a map model"); + Assert.assertEquals(cm.additionalPropertiesType, "string"); + } + + @Test(description = "convert an complex additional properties model") + public void arrayModelAdditionalPropertiesComplexTest() { + final Schema schema = new Schema() + .description("a map model") + .additionalProperties(new Schema().type("object").$ref("#/definitions/Children")); + final DefaultCodegen codegen = new TypeScriptNodeClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a map model"); + Assert.assertEquals(cm.additionalPropertiesType, "Children"); + } + @Test(description = "prepend imports with ./ by default") public void defaultFromModelTest() { final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/petstore.yaml"); diff --git a/modules/openapi-generator/src/test/resources/2_0/refAliasedPrimitiveWithValidation.yml b/modules/openapi-generator/src/test/resources/2_0/refAliasedPrimitiveWithValidation.yml new file mode 100644 index 00000000000..372fd0dc677 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/2_0/refAliasedPrimitiveWithValidation.yml @@ -0,0 +1,78 @@ +swagger: '2.0' +info: + description: "Tests models which trigger aliased primitives but contain JSON Schema Validation Properties" + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +host: petstore.swagger.io:80 +basePath: /v2 +tags: + - name: fake + description: A fake api +schemes: + - http +paths: + /fake/StringEnum: + post: + tags: + - fake + description: Test serialization of StringEnum + operationId: StringEnum + parameters: + - name: body + in: body + description: Input string as post body + schema: + $ref: '#/definitions/StringEnum' + responses: + '200': + description: Returned string + schema: + $ref: '#/definitions/StringEnum' + /fake/StringRegex: + post: + tags: + - fake + description: Test serialization of StringRegex + operationId: StringRegex + parameters: + - name: body + in: body + description: Input string as post body + schema: + $ref: '#/definitions/StringRegex' + responses: + '200': + description: Returned string + schema: + $ref: '#/definitions/StringRegex' + /fake/ObjectModelWithRefs: + post: + tags: + - fake + description: Test serialization of ObjectModelWithRefs + operationId: ObjectModelWithRefs + parameters: + - name: body + in: body + description: Input object as post body + schema: + $ref: '#/definitions/ObjectModelWithRefs' + responses: + '200': + description: Returned object + schema: + $ref: '#/definitions/ObjectModelWithRefs' +definitions: + ObjectModelWithRefs: + type: object + required: + - stringRegex + properties: + stringRegex: + $ref: '#/definitions/StringRegex' + StringRegex: + type: string + pattern: '^\d{3}-\d{2}-\d{4}$' \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml b/modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml new file mode 100644 index 00000000000..42ea59d75b1 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml @@ -0,0 +1,45 @@ +openapi: '3.0.1' +info: + version: 1.0.0 + title: MultipartFile test +paths: + /multipart-array: + post: + tags: + - multipart + description: MultipartFile array test + operationId: multipartArray + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + files: + type: array + description: "Many files" + items: + type: string + format: binary + responses: + '204': + description: Successful operation + /multipart-single: + post: + tags: + - multipart + description: Single MultipartFile test + operationId: multipartSingle + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + description: "One file" + type: string + format: binary + responses: + '204': + description: Successful operation \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/issue4584.yaml b/modules/openapi-generator/src/test/resources/3_0/issue4584.yaml new file mode 100644 index 00000000000..e1001fab1a4 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/issue4584.yaml @@ -0,0 +1,110 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: Used for verification of AuthorizationScope resolution issue + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + - petstore_beta_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - petstore_auth: + - 'read:pets' + - petstore_beta_auth: + - 'read:pets' +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://petstore.swagger.io/oauth2/auth + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + tokenUrl: https://petstore.swagger.io/oauth2/token + petstore_beta_auth: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://petstore.beta.swagger.io/oauth2/auth + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + tokenUrl: https://petstore.beta.swagger.io/oauth2/token + schemas: + Pet: + title: a Pet + description: A pet for sale in the pet store + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + name: + type: string + example: doggie + photoUrls: + type: array + items: + type: string + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold diff --git a/modules/openapi-generator/src/test/resources/3_0/oneOf.yaml b/modules/openapi-generator/src/test/resources/3_0/oneOf.yaml index d98fcf6667a..b9f0938421e 100644 --- a/modules/openapi-generator/src/test/resources/3_0/oneOf.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/oneOf.yaml @@ -22,6 +22,9 @@ components: oneOf: - $ref: '#/components/schemas/apple' - $ref: '#/components/schemas/banana' + # additionalProperties: + # type: string + # uncomment this when https://github.com/swagger-api/swagger-parser/issues/1252 is resolved apple: title: apple type: object diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-nullable-required.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-nullable-required.yaml new file mode 100644 index 00000000000..bf36923229e --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-nullable-required.yaml @@ -0,0 +1,723 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +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. + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + 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 + style: form + explode: false + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid status value + security: + - petstore_auth: + - 'read:pets' + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + 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 + style: form + explode: false + schema: + type: array + items: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid tag value + security: + - petstore_auth: + - 'read:pets' + deprecated: true + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: '' + operationId: updatePetWithForm + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + parameters: + - name: api_key + in: header + required: false + 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 + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}/uploadImage': + post: + tags: + - pet + summary: uploads an image + description: '' + operationId: uploadFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + type: string + format: binary + /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 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: '' + operationId: placeOrder + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid Order + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + '/store/order/{orderId}': + get: + 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 + parameters: + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 5 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid ID supplied + '404': + description: Order not found + delete: + 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 + '404': + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + responses: + default: + description: successful operation + security: + - auth_cookie: [] + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithListInput + responses: + default: + description: successful operation + security: + - auth_cookie: [] + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + parameters: + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$' + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string + responses: + '200': + description: successful operation + headers: + Set-Cookie: + description: >- + Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + schema: + type: string + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + 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: + type: string + application/json: + schema: + type: string + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + '/user/{username}': + get: + tags: + - user + summary: Get user by user name + description: '' + operationId: getUserByName + parameters: + - name: username + in: path + description: The name that needs to be fetched. Use user1 for testing. + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Invalid username supplied + '404': + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - auth_cookie: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + delete: + 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 + '404': + description: User not found + security: + - auth_cookie: [] +externalDocs: + description: Find out more about Swagger + url: 'http://swagger.io' +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + 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 + 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 + api_key: + type: apiKey + name: api_key + in: header + auth_cookie: + type: apiKey + name: AUTH_KEY + in: cookie + schemas: + Order: + title: Pet Order + description: An order for a pets from the pet store + 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 + xml: + name: Order + Category: + title: Pet category + description: A category for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$' + xml: + name: Category + User: + title: a User + description: A User who is purchasing from the pet store + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + title: Pet Tag + description: A tag for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + title: a Pet + description: A pet for sale in the pet store + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: '#/components/schemas/Category' + name: + type: string + example: doggie + nullable: true + 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 + xml: + name: Pet + ApiResponse: + title: An uploaded response + description: Describes the result of uploading an image resource + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/recursion.yaml b/modules/openapi-generator/src/test/resources/3_0/recursion.yaml new file mode 100644 index 00000000000..dafd73e8872 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/recursion.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + description: Test + version: 1.0.0 + title: OpenAPI +paths: + /foo: + post: + description: '' + responses: + '200': + description: Response + content: + application/json: + schema: + $ref: '#/components/schemas/Foo' +components: + schemas: + Foo: + type: object + properties: + foo: + $ref: '#/components/schemas/Foo' + Bar: + type: object + properties: + baz: + $ref: '#/components/schemas/Baz' + Baz: + type: object + properties: + bar: + $ref: '#/components/schemas/Bar' diff --git a/pom.xml b/pom.xml index bf0e1b87d75..e05ba7ec0f1 100644 --- a/pom.xml +++ b/pom.xml @@ -1042,7 +1042,7 @@ samples/client/petstore/bash samples/client/petstore/c samples/client/petstore/cpp-qt5 - samples/client/petstore/elm-0.18 + samples/client/petstore/rust samples/client/petstore/php/OpenAPIClient-php @@ -1072,8 +1072,8 @@ - samples/client/petstore/typescript-angular-v4/npm - samples/client/petstore/typescript-angular-v4.3/npm + samples/client/petstore/typescript-angular-v6-provided-in-root samples/client/petstore/typescript-angular-v7-provided-in-root samples/server/petstore/rust-server @@ -1204,6 +1204,7 @@ samples/client/petstore/java/vertx samples/client/petstore/java/resteasy samples/client/petstore/java/google-api-client + samples/client/petstore/java/microprofile-rest-client samples/server/petstore/jaxrs-jersey samples/server/petstore/jaxrs-spec diff --git a/samples/client/petstore/R/R/api_client.R b/samples/client/petstore/R/R/api_client.R index 45396b84391..f6b8544aacd 100644 --- a/samples/client/petstore/R/R/api_client.R +++ b/samples/client/petstore/R/R/api_client.R @@ -149,10 +149,12 @@ ApiClient <- R6::R6Class( } } } 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) + if(!is.null(nrow(obj))){ + 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) + } } } } diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index 05d5d77cce3..6ff2f1510cc 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -10,9 +10,9 @@ #' @title Category #' @description Category Class #' @format An \code{R6Class} generator object -#' @field id integer [optional] +#' @field id integer [optional] #' -#' @field name character [optional] +#' @field name character [optional] #' #' #' @importFrom R6 R6Class diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index 747dcc550a5..ddf573164b7 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -10,11 +10,11 @@ #' @title ModelApiResponse #' @description ModelApiResponse Class #' @format An \code{R6Class} generator object -#' @field code integer [optional] +#' @field code integer [optional] #' -#' @field type character [optional] +#' @field type character [optional] #' -#' @field message character [optional] +#' @field message character [optional] #' #' #' @importFrom R6 R6Class diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index 4629dcfb715..a5acac3bfff 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -10,17 +10,17 @@ #' @title Order #' @description Order Class #' @format An \code{R6Class} generator object -#' @field id integer [optional] +#' @field id integer [optional] #' -#' @field petId integer [optional] +#' @field petId integer [optional] #' -#' @field quantity integer [optional] +#' @field quantity integer [optional] #' -#' @field shipDate character [optional] +#' @field shipDate character [optional] #' -#' @field status character [optional] +#' @field status character [optional] #' -#' @field complete character [optional] +#' @field complete character [optional] #' #' #' @importFrom R6 R6Class diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index 1b2f6161dd8..760463d67ba 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -10,17 +10,17 @@ #' @title Pet #' @description Pet Class #' @format An \code{R6Class} generator object -#' @field id integer [optional] +#' @field id integer [optional] #' -#' @field category \link[petstore:Category]{ Category } [optional] +#' @field category \link{Category} [optional] #' -#' @field name character +#' @field name character #' -#' @field photoUrls list(character) +#' @field photoUrls list( character ) #' -#' @field tags \link[petstore:Tag]{ list(Tag) } [optional] +#' @field tags list( \link{Tag} ) [optional] #' -#' @field status character [optional] +#' @field status character [optional] #' #' #' @importFrom R6 R6Class @@ -107,10 +107,10 @@ Pet <- R6::R6Class( self$`name` <- PetObject$`name` } if (!is.null(PetObject$`photoUrls`)) { - self$`photoUrls` <- ApiClient$new()$deserializeObj(PetObject$`photoUrls`, "array[character]", "package:petstore") + self$`photoUrls` <- ApiClient$new()$deserializeObj(PetObject$`photoUrls`, "array[character]", loadNamespace("petstore")) } if (!is.null(PetObject$`tags`)) { - self$`tags` <- ApiClient$new()$deserializeObj(PetObject$`tags`, "array[Tag]", "package:petstore") + self$`tags` <- ApiClient$new()$deserializeObj(PetObject$`tags`, "array[Tag]", loadNamespace("petstore")) } if (!is.null(PetObject$`status`)) { self$`status` <- PetObject$`status` @@ -169,8 +169,8 @@ Pet <- R6::R6Class( self$`id` <- PetObject$`id` self$`category` <- Category$new()$fromJSON(jsonlite::toJSON(PetObject$category, auto_unbox = TRUE, digits = NA)) self$`name` <- PetObject$`name` - self$`photoUrls` <- ApiClient$new()$deserializeObj(PetObject$`photoUrls`, "array[character]","package:petstore") - self$`tags` <- ApiClient$new()$deserializeObj(PetObject$`tags`, "array[Tag]","package:petstore") + self$`photoUrls` <- ApiClient$new()$deserializeObj(PetObject$`photoUrls`, "array[character]", loadNamespace("petstore")) + self$`tags` <- ApiClient$new()$deserializeObj(PetObject$`tags`, "array[Tag]", loadNamespace("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 7b038534f04..f2e583bbcc5 100644 --- a/samples/client/petstore/R/R/pet_api.R +++ b/samples/client/petstore/R/R/pet_api.R @@ -18,7 +18,7 @@ #' #' #' \itemize{ -#' \item \emph{ @param } body \link[petstore:Pet]{ Pet } +#' \item \emph{ @param } body \link{Pet} #' #' #' \item status code : 405 | Invalid input @@ -52,7 +52,7 @@ #' #' \itemize{ #' \item \emph{ @param } status Enum < [available, pending, sold] > -#' \item \emph{ @returnType } \link[petstore:Pet]{ list(Pet) } \cr +#' \item \emph{ @returnType } list( \link{Pet} ) \cr #' #' #' \item status code : 200 | successful operation @@ -76,7 +76,7 @@ #' #' \itemize{ #' \item \emph{ @param } tags list( character ) -#' \item \emph{ @returnType } \link[petstore:Pet]{ list(Pet) } \cr +#' \item \emph{ @returnType } list( \link{Pet} ) \cr #' #' #' \item status code : 200 | successful operation @@ -100,7 +100,7 @@ #' #' \itemize{ #' \item \emph{ @param } pet.id integer -#' \item \emph{ @returnType } \link[petstore:Pet]{ Pet } \cr +#' \item \emph{ @returnType } \link{Pet} \cr #' #' #' \item status code : 200 | successful operation @@ -130,7 +130,7 @@ #' #' #' \itemize{ -#' \item \emph{ @param } body \link[petstore:Pet]{ Pet } +#' \item \emph{ @param } body \link{Pet} #' #' #' \item status code : 400 | Invalid ID supplied @@ -181,7 +181,7 @@ #' \item \emph{ @param } pet.id integer #' \item \emph{ @param } additional.metadata character #' \item \emph{ @param } file data.frame -#' \item \emph{ @returnType } \link[petstore:ApiResponse]{ ModelApiResponse } \cr +#' \item \emph{ @returnType } \link{ModelApiResponse} \cr #' #' #' \item status code : 200 | successful operation @@ -469,7 +469,7 @@ PetApi <- R6::R6Class( if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "array[Pet]", "package:petstore"), + self$apiClient$deserialize(resp, "array[Pet]", loadNamespace("petstore")), error = function(e){ stop("Failed to deserialize response") } @@ -521,7 +521,7 @@ PetApi <- R6::R6Class( if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "array[Pet]", "package:petstore"), + self$apiClient$deserialize(resp, "array[Pet]", loadNamespace("petstore")), error = function(e){ stop("Failed to deserialize response") } @@ -577,7 +577,7 @@ PetApi <- R6::R6Class( if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "Pet", "package:petstore"), + self$apiClient$deserialize(resp, "Pet", loadNamespace("petstore")), error = function(e){ stop("Failed to deserialize response") } @@ -739,7 +739,7 @@ PetApi <- R6::R6Class( if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "ModelApiResponse", "package:petstore"), + self$apiClient$deserialize(resp, "ModelApiResponse", loadNamespace("petstore")), error = function(e){ stop("Failed to deserialize response") } diff --git a/samples/client/petstore/R/R/store_api.R b/samples/client/petstore/R/R/store_api.R index d46e165c71b..8f45603288d 100644 --- a/samples/client/petstore/R/R/store_api.R +++ b/samples/client/petstore/R/R/store_api.R @@ -57,7 +57,7 @@ #' #' \itemize{ #' \item \emph{ @param } order.id integer -#' \item \emph{ @returnType } \link[petstore:Order]{ Order } \cr +#' \item \emph{ @returnType } \link{Order} \cr #' #' #' \item status code : 200 | successful operation @@ -87,8 +87,8 @@ #' #' #' \itemize{ -#' \item \emph{ @param } body \link[petstore:Order]{ Order } -#' \item \emph{ @returnType } \link[petstore:Order]{ Order } \cr +#' \item \emph{ @param } body \link{Order} +#' \item \emph{ @returnType } \link{Order} \cr #' #' #' \item status code : 200 | successful operation @@ -254,7 +254,7 @@ StoreApi <- R6::R6Class( if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "map(integer)", "package:petstore"), + self$apiClient$deserialize(resp, "map(integer)", loadNamespace("petstore")), error = function(e){ stop("Failed to deserialize response") } @@ -306,7 +306,7 @@ StoreApi <- R6::R6Class( if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "Order", "package:petstore"), + self$apiClient$deserialize(resp, "Order", loadNamespace("petstore")), error = function(e){ stop("Failed to deserialize response") } @@ -360,7 +360,7 @@ StoreApi <- R6::R6Class( if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "Order", "package:petstore"), + self$apiClient$deserialize(resp, "Order", loadNamespace("petstore")), error = function(e){ stop("Failed to deserialize response") } diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index 7e60cb50c82..5644807f5c6 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -10,9 +10,9 @@ #' @title Tag #' @description Tag Class #' @format An \code{R6Class} generator object -#' @field id integer [optional] +#' @field id integer [optional] #' -#' @field name character [optional] +#' @field name character [optional] #' #' #' @importFrom R6 R6Class diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index a3967c84c93..2afd3de04c6 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -10,21 +10,21 @@ #' @title User #' @description User Class #' @format An \code{R6Class} generator object -#' @field id integer [optional] +#' @field id integer [optional] #' -#' @field username character [optional] +#' @field username character [optional] #' -#' @field firstName character [optional] +#' @field firstName character [optional] #' -#' @field lastName character [optional] +#' @field lastName character [optional] #' -#' @field email character [optional] +#' @field email character [optional] #' -#' @field password character [optional] +#' @field password character [optional] #' -#' @field phone character [optional] +#' @field phone character [optional] #' -#' @field userStatus integer [optional] +#' @field userStatus integer [optional] #' #' #' @importFrom R6 R6Class diff --git a/samples/client/petstore/R/R/user_api.R b/samples/client/petstore/R/R/user_api.R index 8eb742c6036..051b5ae8927 100644 --- a/samples/client/petstore/R/R/user_api.R +++ b/samples/client/petstore/R/R/user_api.R @@ -18,7 +18,7 @@ #' This can only be done by the logged in user. #' #' \itemize{ -#' \item \emph{ @param } body \link[petstore:User]{ User } +#' \item \emph{ @param } body \link{User} #' #' #' \item status code : 0 | successful operation @@ -34,7 +34,7 @@ #' #' #' \itemize{ -#' \item \emph{ @param } body list( \link[petstore:User]{ User } ) +#' \item \emph{ @param } body list( \link{User} ) #' #' #' \item status code : 0 | successful operation @@ -50,7 +50,7 @@ #' #' #' \itemize{ -#' \item \emph{ @param } body list( \link[petstore:User]{ User } ) +#' \item \emph{ @param } body list( \link{User} ) #' #' #' \item status code : 0 | successful operation @@ -90,7 +90,7 @@ #' #' \itemize{ #' \item \emph{ @param } username character -#' \item \emph{ @returnType } \link[petstore:User]{ User } \cr +#' \item \emph{ @returnType } \link{User} \cr #' #' #' \item status code : 200 | successful operation @@ -162,7 +162,7 @@ #' #' \itemize{ #' \item \emph{ @param } username character -#' \item \emph{ @param } body \link[petstore:User]{ User } +#' \item \emph{ @param } body \link{User} #' #' #' \item status code : 400 | Invalid user supplied @@ -521,7 +521,7 @@ UserApi <- R6::R6Class( if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "User", "package:petstore"), + self$apiClient$deserialize(resp, "User", loadNamespace("petstore")), error = function(e){ stop("Failed to deserialize response") } @@ -577,7 +577,7 @@ UserApi <- R6::R6Class( if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { deserializedRespObj <- tryCatch( - self$apiClient$deserialize(resp, "character", "package:petstore"), + self$apiClient$deserialize(resp, "character", loadNamespace("petstore")), error = function(e){ stop("Failed to deserialize response") } diff --git a/samples/client/petstore/c/.openapi-generator/VERSION b/samples/client/petstore/c/.openapi-generator/VERSION index d168f1d8bda..e4955748d3e 100644 --- a/samples/client/petstore/c/.openapi-generator/VERSION +++ b/samples/client/petstore/c/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.1-SNAPSHOT \ No newline at end of file +4.2.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/c/CMakeLists.txt b/samples/client/petstore/c/CMakeLists.txt index 1de992031da..e685f785dde 100644 --- a/samples/client/petstore/c/CMakeLists.txt +++ b/samples/client/petstore/c/CMakeLists.txt @@ -63,27 +63,28 @@ install(TARGETS ${pkgName} DESTINATION ${CMAKE_INSTALL_PREFIX}) set(SRCS "") set(HDRS "") -# This section shows how to use the above compiled libary to compile the source files -# set source files -set(SRCS - unit-tests/manual-PetAPI.c - unit-tests/manual-StoreAPI.c - unit-tests/manual-UserAPI.c - unit-tests/manual-order.c - unit-tests/manual-user.c) -#set header files -set(HDRS -) +## This section shows how to use the above compiled libary to compile the source files +## set source files +#set(SRCS +# unit-tests/manual-PetAPI.c +# unit-tests/manual-StoreAPI.c +# unit-tests/manual-UserAPI.c +# unit-tests/manual-order.c +# unit-tests/manual-user.c) -# loop over all files in SRCS variable -foreach(SOURCE_FILE ${SRCS}) - # Get only the file name from the file as add_executable doesnot support executable with slash("/") - get_filename_component(FILE_NAME_ONLY ${SOURCE_FILE} NAME_WE) - # Remove .c from the file name and set it as executable name - string( REPLACE ".c" "" EXECUTABLE_FILE ${FILE_NAME_ONLY}) - # Add executable for every source file in SRCS - add_executable(unit-${EXECUTABLE_FILE} ${SOURCE_FILE}) - # Link above created libary to executable and dependent libary curl - target_link_libraries(unit-${EXECUTABLE_FILE} ${CURL_LIBRARIES} ${pkgName} ) -endforeach(SOURCE_FILE ${SRCS}) +##set header files +#set(HDRS +#) + +## loop over all files in SRCS variable +#foreach(SOURCE_FILE ${SRCS}) +# # Get only the file name from the file as add_executable doesnot support executable with slash("/") +# get_filename_component(FILE_NAME_ONLY ${SOURCE_FILE} NAME_WE) +# # Remove .c from the file name and set it as executable name +# string( REPLACE ".c" "" EXECUTABLE_FILE ${FILE_NAME_ONLY}) +# # Add executable for every source file in SRCS +# add_executable(unit-${EXECUTABLE_FILE} ${SOURCE_FILE}) +# # Link above created libary to executable and dependent libary curl +# target_link_libraries(unit-${EXECUTABLE_FILE} ${CURL_LIBRARIES} ${pkgName} ) +#endforeach(SOURCE_FILE ${SRCS}) diff --git a/samples/client/petstore/c/api/PetAPI.c b/samples/client/petstore/c/api/PetAPI.c index cc7bc440c84..59383928642 100644 --- a/samples/client/petstore/c/api/PetAPI.c +++ b/samples/client/petstore/c/api/PetAPI.c @@ -6,630 +6,643 @@ #define MAX_BUFFER_LENGTH 4096 #define intToStr(dst, src) \ - do { \ - char dst[256]; \ - snprintf(dst, 256, "%ld", (long int) (src)); \ - } while(0) + do {\ + char dst[256];\ + snprintf(dst, 256, "%ld", (long int)(src));\ +}while(0) // Add a new pet to the store // -void PetAPI_addPet(apiClient_t *apiClient, pet_t *body) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = list_create(); - char *localVarBodyParameters = NULL; +void +PetAPI_addPet(apiClient_t *apiClient ,pet_t * body) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = list_create(); + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/pet") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/pet"); + // create the path + long sizeOfPath = strlen("/pet")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/pet"); - // Body Param - cJSON *localVarSingleItemJSON_body; - if(body != NULL) { - // string - localVarSingleItemJSON_body = pet_convertToJSON(body); - localVarBodyParameters = - cJSON_Print(localVarSingleItemJSON_body); - } - list_addElement(localVarContentType, "application/json"); // consumes - list_addElement(localVarContentType, "application/xml"); // consumes - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "POST"); + // Body Param + cJSON *localVarSingleItemJSON_body; + if (body != NULL) + { + //string + localVarSingleItemJSON_body = pet_convertToJSON(body); + localVarBodyParameters = cJSON_Print(localVarSingleItemJSON_body); + } + list_addElement(localVarContentType,"application/json"); //consumes + list_addElement(localVarContentType,"application/xml"); //consumes + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "POST"); - if(apiClient->response_code == 405) { - printf("%s\n", "Invalid input"); - } - // No return type + if (apiClient->response_code == 405) { + printf("%s\n","Invalid input"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + + list_free(localVarContentType); + free(localVarPath); + cJSON_Delete(localVarSingleItemJSON_body); + free(localVarBodyParameters); - - - - list_free(localVarContentType); - free(localVarPath); - cJSON_Delete(localVarSingleItemJSON_body); - free(localVarBodyParameters); } // Deletes a pet // -void PetAPI_deletePet(apiClient_t *apiClient, long petId, char *api_key) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = list_create(); - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +void +PetAPI_deletePet(apiClient_t *apiClient ,long petId ,char * api_key) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = list_create(); + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/pet/{petId}") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/pet/{petId}"); + // create the path + long sizeOfPath = strlen("/pet/{petId}")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/pet/{petId}"); - // Path Params - long sizeOfPathParams_petId = sizeof(petId) + 3 + strlen("{ petId }"); - if(petId == 0) { - goto end; - } - char *localVarToReplace_petId = malloc(sizeOfPathParams_petId); - snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", - "petId"); + // Path Params + long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }"); + if(petId == 0){ + goto end; + } + char* localVarToReplace_petId = malloc(sizeOfPathParams_petId); + snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); - char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + char localVarBuff_petId[256]; + intToStr(localVarBuff_petId, petId); - localVarPath = strReplace(localVarPath, localVarToReplace_petId, - localVarBuff_petId); + localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); - // header parameters - char *keyHeader_api_key; - char *valueHeader_api_key; - keyValuePair_t *keyPairHeader_api_key = 0; - if(api_key) { - keyHeader_api_key = strdup("api_key"); - valueHeader_api_key = strdup((api_key)); - keyPairHeader_api_key = keyValuePair_create(keyHeader_api_key, - valueHeader_api_key); - list_addElement(localVarHeaderParameters, - keyPairHeader_api_key); - } + // header parameters + char *keyHeader_api_key; + char * valueHeader_api_key; + keyValuePair_t *keyPairHeader_api_key = 0; + if (api_key) { + keyHeader_api_key = strdup("api_key"); + valueHeader_api_key = strdup((api_key)); + keyPairHeader_api_key = keyValuePair_create(keyHeader_api_key, valueHeader_api_key); + list_addElement(localVarHeaderParameters,keyPairHeader_api_key); + } - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "DELETE"); + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "DELETE"); - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid pet value"); - } - // No return type + if (apiClient->response_code == 400) { + printf("%s\n","Invalid pet value"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + list_free(localVarHeaderParameters); + + + + free(localVarPath); + free(localVarToReplace_petId); + free(keyHeader_api_key); + free(valueHeader_api_key); + free(keyPairHeader_api_key); - list_free(localVarHeaderParameters); - - - - free(localVarPath); - free(localVarToReplace_petId); - free(keyHeader_api_key); - free(valueHeader_api_key); - free(keyPairHeader_api_key); } // Finds Pets by status // // Multiple status values can be provided with comma separated strings // -list_t *PetAPI_findPetsByStatus(apiClient_t *apiClient, list_t *status) { - list_t *localVarQueryParameters = list_create(); - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = list_create(); - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +list_t* +PetAPI_findPetsByStatus(apiClient_t *apiClient ,list_t * status) +{ + list_t *localVarQueryParameters = list_create(); + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = list_create(); + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/pet/findByStatus") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/pet/findByStatus"); + // create the path + long sizeOfPath = strlen("/pet/findByStatus")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/pet/findByStatus"); - // query parameters - if(status) { - list_addElement(localVarQueryParameters, status); - } - list_addElement(localVarHeaderType, "application/xml"); // produces - list_addElement(localVarHeaderType, "application/json"); // produces - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "GET"); + // query parameters + if (status) + { + list_addElement(localVarQueryParameters,status); + } + list_addElement(localVarHeaderType,"application/xml"); //produces + list_addElement(localVarHeaderType,"application/json"); //produces + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "GET"); - if(apiClient->response_code == 200) { - printf("%s\n", "successful operation"); - } - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid status value"); - } - cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); - if(!cJSON_IsArray(PetAPIlocalVarJSON)) { - return 0; // nonprimitive container - } - list_t *elementToReturn = list_create(); - cJSON *VarJSON; - cJSON_ArrayForEach(VarJSON, PetAPIlocalVarJSON) - { - if(!cJSON_IsObject(VarJSON)) { - // return 0; - } - char *localVarJSONToChar = cJSON_Print(VarJSON); - list_addElement(elementToReturn, localVarJSONToChar); - } + if (apiClient->response_code == 200) { + printf("%s\n","successful operation"); + } + if (apiClient->response_code == 400) { + printf("%s\n","Invalid status value"); + } + cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); + if(!cJSON_IsArray(PetAPIlocalVarJSON)) { + return 0;//nonprimitive container + } + list_t *elementToReturn = list_create(); + cJSON *VarJSON; + cJSON_ArrayForEach(VarJSON, PetAPIlocalVarJSON) + { + if(!cJSON_IsObject(VarJSON)) + { + // return 0; + } + char *localVarJSONToChar = cJSON_Print(VarJSON); + list_addElement(elementToReturn , localVarJSONToChar); + } - cJSON_Delete(PetAPIlocalVarJSON); - cJSON_Delete(VarJSON); - // return type - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } - list_free(localVarQueryParameters); - - - list_free(localVarHeaderType); - - free(localVarPath); - return elementToReturn; + cJSON_Delete( PetAPIlocalVarJSON); + cJSON_Delete( VarJSON); + //return type + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + list_free(localVarQueryParameters); + + + list_free(localVarHeaderType); + + free(localVarPath); + return elementToReturn; end: - return NULL; + return NULL; + } // Finds Pets by tags // // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. // -list_t *PetAPI_findPetsByTags(apiClient_t *apiClient, list_t *tags) { - list_t *localVarQueryParameters = list_create(); - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = list_create(); - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +list_t* +PetAPI_findPetsByTags(apiClient_t *apiClient ,list_t * tags) +{ + list_t *localVarQueryParameters = list_create(); + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = list_create(); + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/pet/findByTags") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/pet/findByTags"); + // create the path + long sizeOfPath = strlen("/pet/findByTags")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/pet/findByTags"); - // query parameters - if(tags) { - list_addElement(localVarQueryParameters, tags); - } - list_addElement(localVarHeaderType, "application/xml"); // produces - list_addElement(localVarHeaderType, "application/json"); // produces - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "GET"); + // query parameters + if (tags) + { + list_addElement(localVarQueryParameters,tags); + } + list_addElement(localVarHeaderType,"application/xml"); //produces + list_addElement(localVarHeaderType,"application/json"); //produces + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "GET"); - if(apiClient->response_code == 200) { - printf("%s\n", "successful operation"); - } - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid tag value"); - } - cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); - if(!cJSON_IsArray(PetAPIlocalVarJSON)) { - return 0; // nonprimitive container - } - list_t *elementToReturn = list_create(); - cJSON *VarJSON; - cJSON_ArrayForEach(VarJSON, PetAPIlocalVarJSON) - { - if(!cJSON_IsObject(VarJSON)) { - // return 0; - } - char *localVarJSONToChar = cJSON_Print(VarJSON); - list_addElement(elementToReturn, localVarJSONToChar); - } + if (apiClient->response_code == 200) { + printf("%s\n","successful operation"); + } + if (apiClient->response_code == 400) { + printf("%s\n","Invalid tag value"); + } + cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); + if(!cJSON_IsArray(PetAPIlocalVarJSON)) { + return 0;//nonprimitive container + } + list_t *elementToReturn = list_create(); + cJSON *VarJSON; + cJSON_ArrayForEach(VarJSON, PetAPIlocalVarJSON) + { + if(!cJSON_IsObject(VarJSON)) + { + // return 0; + } + char *localVarJSONToChar = cJSON_Print(VarJSON); + list_addElement(elementToReturn , localVarJSONToChar); + } - cJSON_Delete(PetAPIlocalVarJSON); - cJSON_Delete(VarJSON); - // return type - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } - list_free(localVarQueryParameters); - - - list_free(localVarHeaderType); - - free(localVarPath); - return elementToReturn; + cJSON_Delete( PetAPIlocalVarJSON); + cJSON_Delete( VarJSON); + //return type + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + list_free(localVarQueryParameters); + + + list_free(localVarHeaderType); + + free(localVarPath); + return elementToReturn; end: - return NULL; + return NULL; + } // Find pet by ID // // Returns a single pet // -pet_t *PetAPI_getPetById(apiClient_t *apiClient, long petId) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = list_create(); - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +pet_t* +PetAPI_getPetById(apiClient_t *apiClient ,long petId) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = list_create(); + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/pet/{petId}") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/pet/{petId}"); + // create the path + long sizeOfPath = strlen("/pet/{petId}")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/pet/{petId}"); - // Path Params - long sizeOfPathParams_petId = sizeof(petId) + 3 + strlen("{ petId }"); - if(petId == 0) { - goto end; - } - char *localVarToReplace_petId = malloc(sizeOfPathParams_petId); - snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", - "petId"); + // Path Params + long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }"); + if(petId == 0){ + goto end; + } + char* localVarToReplace_petId = malloc(sizeOfPathParams_petId); + snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); - char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + char localVarBuff_petId[256]; + intToStr(localVarBuff_petId, petId); - localVarPath = strReplace(localVarPath, localVarToReplace_petId, - localVarBuff_petId); + localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); - list_addElement(localVarHeaderType, "application/xml"); // produces - list_addElement(localVarHeaderType, "application/json"); // produces - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "GET"); + list_addElement(localVarHeaderType,"application/xml"); //produces + list_addElement(localVarHeaderType,"application/json"); //produces + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "GET"); - if(apiClient->response_code == 200) { - printf("%s\n", "successful operation"); - } - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid ID supplied"); - } - if(apiClient->response_code == 404) { - printf("%s\n", "Pet not found"); - } - // nonprimitive not container - cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); - pet_t *elementToReturn = pet_parseFromJSON(PetAPIlocalVarJSON); - cJSON_Delete(PetAPIlocalVarJSON); - if(elementToReturn == NULL) { - // return 0; - } + if (apiClient->response_code == 200) { + printf("%s\n","successful operation"); + } + if (apiClient->response_code == 400) { + printf("%s\n","Invalid ID supplied"); + } + if (apiClient->response_code == 404) { + printf("%s\n","Pet not found"); + } + //nonprimitive not container + cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); + pet_t *elementToReturn = pet_parseFromJSON(PetAPIlocalVarJSON); + cJSON_Delete(PetAPIlocalVarJSON); + if(elementToReturn == NULL) { + // return 0; + } - // return type - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } - - - - list_free(localVarHeaderType); - - free(localVarPath); - free(localVarToReplace_petId); - return elementToReturn; + //return type + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + list_free(localVarHeaderType); + + free(localVarPath); + free(localVarToReplace_petId); + return elementToReturn; end: - return NULL; + return NULL; + } // Update an existing pet // -void PetAPI_updatePet(apiClient_t *apiClient, pet_t *body) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = list_create(); - char *localVarBodyParameters = NULL; +void +PetAPI_updatePet(apiClient_t *apiClient ,pet_t * body) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = list_create(); + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/pet") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/pet"); + // create the path + long sizeOfPath = strlen("/pet")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/pet"); - // Body Param - cJSON *localVarSingleItemJSON_body; - if(body != NULL) { - // string - localVarSingleItemJSON_body = pet_convertToJSON(body); - localVarBodyParameters = - cJSON_Print(localVarSingleItemJSON_body); - } - list_addElement(localVarContentType, "application/json"); // consumes - list_addElement(localVarContentType, "application/xml"); // consumes - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "PUT"); + // Body Param + cJSON *localVarSingleItemJSON_body; + if (body != NULL) + { + //string + localVarSingleItemJSON_body = pet_convertToJSON(body); + localVarBodyParameters = cJSON_Print(localVarSingleItemJSON_body); + } + list_addElement(localVarContentType,"application/json"); //consumes + list_addElement(localVarContentType,"application/xml"); //consumes + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "PUT"); - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid ID supplied"); - } - if(apiClient->response_code == 404) { - printf("%s\n", "Pet not found"); - } - if(apiClient->response_code == 405) { - printf("%s\n", "Validation exception"); - } - // No return type + if (apiClient->response_code == 400) { + printf("%s\n","Invalid ID supplied"); + } + if (apiClient->response_code == 404) { + printf("%s\n","Pet not found"); + } + if (apiClient->response_code == 405) { + printf("%s\n","Validation exception"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + + list_free(localVarContentType); + free(localVarPath); + cJSON_Delete(localVarSingleItemJSON_body); + free(localVarBodyParameters); - - - - list_free(localVarContentType); - free(localVarPath); - cJSON_Delete(localVarSingleItemJSON_body); - free(localVarBodyParameters); } // Updates a pet in the store with form data // -void PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId, char *name, - char *status) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = list_create(); - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = list_create(); - char *localVarBodyParameters = NULL; +void +PetAPI_updatePetWithForm(apiClient_t *apiClient ,long petId ,char * name ,char * status) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = list_create(); + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = list_create(); + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/pet/{petId}") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/pet/{petId}"); + // create the path + long sizeOfPath = strlen("/pet/{petId}")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/pet/{petId}"); - // Path Params - long sizeOfPathParams_petId = sizeof(petId) + 3 + strlen("{ petId }"); - if(petId == 0) { - goto end; - } - char *localVarToReplace_petId = malloc(sizeOfPathParams_petId); - snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", - "petId"); + // Path Params + long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }"); + if(petId == 0){ + goto end; + } + char* localVarToReplace_petId = malloc(sizeOfPathParams_petId); + snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); - char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + char localVarBuff_petId[256]; + intToStr(localVarBuff_petId, petId); - localVarPath = strReplace(localVarPath, localVarToReplace_petId, - localVarBuff_petId); + localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); - // form parameters - char *keyForm_name; - char *valueForm_name; - keyValuePair_t *keyPairForm_name = 0; - if(name != NULL) { - keyForm_name = strdup("name"); - valueForm_name = strdup((name)); - keyPairForm_name = keyValuePair_create(keyForm_name, - valueForm_name); - list_addElement(localVarFormParameters, keyPairForm_name); - } + // form parameters + char *keyForm_name; + char * valueForm_name; + keyValuePair_t *keyPairForm_name = 0; + if (name != NULL) + { + keyForm_name = strdup("name"); + valueForm_name = strdup((name)); + keyPairForm_name = keyValuePair_create(keyForm_name,valueForm_name); + list_addElement(localVarFormParameters,keyPairForm_name); + } - // form parameters - char *keyForm_status; - char *valueForm_status; - keyValuePair_t *keyPairForm_status = 0; - if(status != NULL) { - keyForm_status = strdup("status"); - valueForm_status = strdup((status)); - keyPairForm_status = keyValuePair_create(keyForm_status, - valueForm_status); - list_addElement(localVarFormParameters, keyPairForm_status); - } - list_addElement(localVarContentType, - "application/x-www-form-urlencoded"); // consumes - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "POST"); + // form parameters + char *keyForm_status; + char * valueForm_status; + keyValuePair_t *keyPairForm_status = 0; + if (status != NULL) + { + keyForm_status = strdup("status"); + valueForm_status = strdup((status)); + keyPairForm_status = keyValuePair_create(keyForm_status,valueForm_status); + list_addElement(localVarFormParameters,keyPairForm_status); + } + list_addElement(localVarContentType,"application/x-www-form-urlencoded"); //consumes + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "POST"); - if(apiClient->response_code == 405) { - printf("%s\n", "Invalid input"); - } - // No return type + if (apiClient->response_code == 405) { + printf("%s\n","Invalid input"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + list_free(localVarFormParameters); + + list_free(localVarContentType); + free(localVarPath); + free(localVarToReplace_petId); + free(keyForm_name); + free(valueForm_name); + keyValuePair_free(keyPairForm_name); + free(keyForm_status); + free(valueForm_status); + keyValuePair_free(keyPairForm_status); - - list_free(localVarFormParameters); - - list_free(localVarContentType); - free(localVarPath); - free(localVarToReplace_petId); - free(keyForm_name); - free(valueForm_name); - keyValuePair_free(keyPairForm_name); - free(keyForm_status); - free(valueForm_status); - keyValuePair_free(keyPairForm_status); } // uploads an image // -api_response_t *PetAPI_uploadFile(apiClient_t *apiClient, long petId, - char *additionalMetadata, binary_t *file) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = list_create(); - list_t *localVarHeaderType = list_create(); - list_t *localVarContentType = list_create(); - char *localVarBodyParameters = NULL; +api_response_t* +PetAPI_uploadFile(apiClient_t *apiClient ,long petId ,char * additionalMetadata ,binary_t* file) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = list_create(); + list_t *localVarHeaderType = list_create(); + list_t *localVarContentType = list_create(); + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/pet/{petId}/uploadImage") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/pet/{petId}/uploadImage"); + // create the path + long sizeOfPath = strlen("/pet/{petId}/uploadImage")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/pet/{petId}/uploadImage"); - // Path Params - long sizeOfPathParams_petId = sizeof(petId) + 3 + strlen("{ petId }"); - if(petId == 0) { - goto end; - } - char *localVarToReplace_petId = malloc(sizeOfPathParams_petId); - snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", - "petId"); + // Path Params + long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }"); + if(petId == 0){ + goto end; + } + char* localVarToReplace_petId = malloc(sizeOfPathParams_petId); + snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); - char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + char localVarBuff_petId[256]; + intToStr(localVarBuff_petId, petId); - localVarPath = strReplace(localVarPath, localVarToReplace_petId, - localVarBuff_petId); + localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); - // form parameters - char *keyForm_additionalMetadata; - char *valueForm_additionalMetadata; - keyValuePair_t *keyPairForm_additionalMetadata = 0; - if(additionalMetadata != NULL) { - keyForm_additionalMetadata = strdup("additionalMetadata"); - valueForm_additionalMetadata = strdup((additionalMetadata)); - keyPairForm_additionalMetadata = keyValuePair_create( - keyForm_additionalMetadata, - valueForm_additionalMetadata); - list_addElement(localVarFormParameters, - keyPairForm_additionalMetadata); - } + // form parameters + char *keyForm_additionalMetadata; + char * valueForm_additionalMetadata; + keyValuePair_t *keyPairForm_additionalMetadata = 0; + if (additionalMetadata != NULL) + { + keyForm_additionalMetadata = strdup("additionalMetadata"); + valueForm_additionalMetadata = strdup((additionalMetadata)); + keyPairForm_additionalMetadata = keyValuePair_create(keyForm_additionalMetadata,valueForm_additionalMetadata); + list_addElement(localVarFormParameters,keyPairForm_additionalMetadata); + } - // form parameters - char *keyForm_file; - binary_t *valueForm_file; - keyValuePair_t *keyPairForm_file = 0; - if(file != NULL) { - keyForm_file = strdup("file"); - valueForm_file = file; - keyPairForm_file = keyValuePair_create(keyForm_file, - &valueForm_file); - list_addElement(localVarFormParameters, keyPairForm_file); // file adding - } - list_addElement(localVarHeaderType, "application/json"); // produces - list_addElement(localVarContentType, "multipart/form-data"); // consumes - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "POST"); + // form parameters + char *keyForm_file; + binary_t* valueForm_file; + keyValuePair_t *keyPairForm_file = 0; + if (file != NULL) + { + keyForm_file = strdup("file"); + valueForm_file = file; + keyPairForm_file = keyValuePair_create(keyForm_file, &valueForm_file); + list_addElement(localVarFormParameters,keyPairForm_file); //file adding + } + list_addElement(localVarHeaderType,"application/json"); //produces + list_addElement(localVarContentType,"multipart/form-data"); //consumes + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "POST"); - if(apiClient->response_code == 200) { - printf("%s\n", "successful operation"); - } - // nonprimitive not container - cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); - api_response_t *elementToReturn = api_response_parseFromJSON( - PetAPIlocalVarJSON); - cJSON_Delete(PetAPIlocalVarJSON); - if(elementToReturn == NULL) { - // return 0; - } + if (apiClient->response_code == 200) { + printf("%s\n","successful operation"); + } + //nonprimitive not container + cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); + api_response_t *elementToReturn = api_response_parseFromJSON(PetAPIlocalVarJSON); + cJSON_Delete(PetAPIlocalVarJSON); + if(elementToReturn == NULL) { + // return 0; + } - // return type - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } - - - list_free(localVarFormParameters); - list_free(localVarHeaderType); - list_free(localVarContentType); - free(localVarPath); - free(localVarToReplace_petId); - free(keyForm_additionalMetadata); - free(valueForm_additionalMetadata); - free(keyPairForm_additionalMetadata); - free(keyForm_file); -// free(fileVar_file->data); -// free(fileVar_file); - free(keyPairForm_file); - return elementToReturn; + //return type + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + list_free(localVarFormParameters); + list_free(localVarHeaderType); + list_free(localVarContentType); + free(localVarPath); + free(localVarToReplace_petId); + free(keyForm_additionalMetadata); + free(valueForm_additionalMetadata); + free(keyPairForm_additionalMetadata); + free(keyForm_file); +// free(fileVar_file->data); +// free(fileVar_file); + free(keyPairForm_file); + return elementToReturn; end: - return NULL; + return NULL; + } + diff --git a/samples/client/petstore/c/api/PetAPI.h b/samples/client/petstore/c/api/PetAPI.h index be1693168a1..5cb6c9de2c6 100644 --- a/samples/client/petstore/c/api/PetAPI.h +++ b/samples/client/petstore/c/api/PetAPI.h @@ -10,47 +10,55 @@ // Add a new pet to the store // -void PetAPI_addPet(apiClient_t *apiClient, pet_t *body); +void +PetAPI_addPet(apiClient_t *apiClient ,pet_t * body); // Deletes a pet // -void PetAPI_deletePet(apiClient_t *apiClient, long petId, char *api_key); +void +PetAPI_deletePet(apiClient_t *apiClient ,long petId ,char * api_key); // Finds Pets by status // // Multiple status values can be provided with comma separated strings // -list_t *PetAPI_findPetsByStatus(apiClient_t *apiClient, list_t *status); +list_t* +PetAPI_findPetsByStatus(apiClient_t *apiClient ,list_t * status); // Finds Pets by tags // // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. // -list_t *PetAPI_findPetsByTags(apiClient_t *apiClient, list_t *tags); +list_t* +PetAPI_findPetsByTags(apiClient_t *apiClient ,list_t * tags); // Find pet by ID // // Returns a single pet // -pet_t *PetAPI_getPetById(apiClient_t *apiClient, long petId); +pet_t* +PetAPI_getPetById(apiClient_t *apiClient ,long petId); // Update an existing pet // -void PetAPI_updatePet(apiClient_t *apiClient, pet_t *body); +void +PetAPI_updatePet(apiClient_t *apiClient ,pet_t * body); // Updates a pet in the store with form data // -void PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId, char *name, - char *status); +void +PetAPI_updatePetWithForm(apiClient_t *apiClient ,long petId ,char * name ,char * status); // uploads an image // -api_response_t *PetAPI_uploadFile(apiClient_t *apiClient, long petId, - char *additionalMetadata, binary_t *file); +api_response_t* +PetAPI_uploadFile(apiClient_t *apiClient ,long petId ,char * additionalMetadata ,binary_t* file); + + diff --git a/samples/client/petstore/c/api/StoreAPI.c b/samples/client/petstore/c/api/StoreAPI.c index 11dabde964f..0a4a3a37fed 100644 --- a/samples/client/petstore/c/api/StoreAPI.c +++ b/samples/client/petstore/c/api/StoreAPI.c @@ -6,278 +6,283 @@ #define MAX_BUFFER_LENGTH 4096 #define intToStr(dst, src) \ - do { \ - char dst[256]; \ - snprintf(dst, 256, "%ld", (long int) (src)); \ - } while(0) + do {\ + char dst[256];\ + snprintf(dst, 256, "%ld", (long int)(src));\ +}while(0) // Delete purchase order by ID // // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors // -void StoreAPI_deleteOrder(apiClient_t *apiClient, char *orderId) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +void +StoreAPI_deleteOrder(apiClient_t *apiClient ,char * orderId) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/store/order/{orderId}") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/store/order/{orderId}"); + // create the path + long sizeOfPath = strlen("/store/order/{orderId}")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/store/order/{orderId}"); - // Path Params - long sizeOfPathParams_orderId = strlen(orderId) + 3 + strlen( - "{ orderId }"); - if(orderId == NULL) { - goto end; - } - char *localVarToReplace_orderId = malloc(sizeOfPathParams_orderId); - sprintf(localVarToReplace_orderId, "{%s}", "orderId"); + // Path Params + long sizeOfPathParams_orderId = strlen(orderId)+3 + strlen("{ orderId }"); + if(orderId == NULL) { + goto end; + } + char* localVarToReplace_orderId = malloc(sizeOfPathParams_orderId); + sprintf(localVarToReplace_orderId, "{%s}", "orderId"); - localVarPath = strReplace(localVarPath, localVarToReplace_orderId, - orderId); + localVarPath = strReplace(localVarPath, localVarToReplace_orderId, orderId); - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "DELETE"); + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "DELETE"); - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid ID supplied"); - } - if(apiClient->response_code == 404) { - printf("%s\n", "Order not found"); - } - // No return type + if (apiClient->response_code == 400) { + printf("%s\n","Invalid ID supplied"); + } + if (apiClient->response_code == 404) { + printf("%s\n","Order not found"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + + + free(localVarPath); + free(localVarToReplace_orderId); - - - - - free(localVarPath); - free(localVarToReplace_orderId); } // Returns pet inventories by status // // Returns a map of status codes to quantities // -list_t *StoreAPI_getInventory(apiClient_t *apiClient) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = list_create(); - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +list_t* +StoreAPI_getInventory(apiClient_t *apiClient) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = list_create(); + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/store/inventory") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/store/inventory"); + // create the path + long sizeOfPath = strlen("/store/inventory")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/store/inventory"); - list_addElement(localVarHeaderType, "application/json"); // produces - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "GET"); + list_addElement(localVarHeaderType,"application/json"); //produces + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "GET"); - if(apiClient->response_code == 200) { - printf("%s\n", "successful operation"); - } - // primitive reutrn type not simple - cJSON *localVarJSON = cJSON_Parse(apiClient->dataReceived); - cJSON *VarJSON; - list_t *elementToReturn = list_create(); - cJSON_ArrayForEach(VarJSON, localVarJSON) { - keyValuePair_t *keyPair = - keyValuePair_create(strdup( - VarJSON->string), cJSON_Print( - VarJSON)); - list_addElement(elementToReturn, keyPair); - } - cJSON_Delete(localVarJSON); + if (apiClient->response_code == 200) { + printf("%s\n","successful operation"); + } + //primitive reutrn type not simple + cJSON *localVarJSON = cJSON_Parse(apiClient->dataReceived); + cJSON *VarJSON; + list_t *elementToReturn = list_create(); + cJSON_ArrayForEach(VarJSON, localVarJSON){ + keyValuePair_t *keyPair = keyValuePair_create(strdup(VarJSON->string), cJSON_Print(VarJSON)); + list_addElement(elementToReturn, keyPair); + } + cJSON_Delete(localVarJSON); - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } - - - - list_free(localVarHeaderType); - - free(localVarPath); - return elementToReturn; + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + list_free(localVarHeaderType); + + free(localVarPath); + return elementToReturn; end: - return NULL; + return NULL; + } // Find purchase order by ID // // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions // -order_t *StoreAPI_getOrderById(apiClient_t *apiClient, long orderId) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = list_create(); - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +order_t* +StoreAPI_getOrderById(apiClient_t *apiClient ,long orderId) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = list_create(); + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/store/order/{orderId}") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/store/order/{orderId}"); + // create the path + long sizeOfPath = strlen("/store/order/{orderId}")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/store/order/{orderId}"); - // Path Params - long sizeOfPathParams_orderId = sizeof(orderId) + 3 + strlen( - "{ orderId }"); - if(orderId == 0) { - goto end; - } - char *localVarToReplace_orderId = malloc(sizeOfPathParams_orderId); - snprintf(localVarToReplace_orderId, sizeOfPathParams_orderId, "{%s}", - "orderId"); + // Path Params + long sizeOfPathParams_orderId = sizeof(orderId)+3 + strlen("{ orderId }"); + if(orderId == 0){ + goto end; + } + char* localVarToReplace_orderId = malloc(sizeOfPathParams_orderId); + snprintf(localVarToReplace_orderId, sizeOfPathParams_orderId, "{%s}", "orderId"); - char localVarBuff_orderId[256]; - intToStr(localVarBuff_orderId, orderId); + char localVarBuff_orderId[256]; + intToStr(localVarBuff_orderId, orderId); - localVarPath = strReplace(localVarPath, localVarToReplace_orderId, - localVarBuff_orderId); + localVarPath = strReplace(localVarPath, localVarToReplace_orderId, localVarBuff_orderId); - list_addElement(localVarHeaderType, "application/xml"); // produces - list_addElement(localVarHeaderType, "application/json"); // produces - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "GET"); + list_addElement(localVarHeaderType,"application/xml"); //produces + list_addElement(localVarHeaderType,"application/json"); //produces + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "GET"); - if(apiClient->response_code == 200) { - printf("%s\n", "successful operation"); - } - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid ID supplied"); - } - if(apiClient->response_code == 404) { - printf("%s\n", "Order not found"); - } - // nonprimitive not container - cJSON *StoreAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); - order_t *elementToReturn = order_parseFromJSON(StoreAPIlocalVarJSON); - cJSON_Delete(StoreAPIlocalVarJSON); - if(elementToReturn == NULL) { - // return 0; - } + if (apiClient->response_code == 200) { + printf("%s\n","successful operation"); + } + if (apiClient->response_code == 400) { + printf("%s\n","Invalid ID supplied"); + } + if (apiClient->response_code == 404) { + printf("%s\n","Order not found"); + } + //nonprimitive not container + cJSON *StoreAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); + order_t *elementToReturn = order_parseFromJSON(StoreAPIlocalVarJSON); + cJSON_Delete(StoreAPIlocalVarJSON); + if(elementToReturn == NULL) { + // return 0; + } - // return type - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } - - - - list_free(localVarHeaderType); - - free(localVarPath); - free(localVarToReplace_orderId); - return elementToReturn; + //return type + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + list_free(localVarHeaderType); + + free(localVarPath); + free(localVarToReplace_orderId); + return elementToReturn; end: - return NULL; + return NULL; + } // Place an order for a pet // -order_t *StoreAPI_placeOrder(apiClient_t *apiClient, order_t *body) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = list_create(); - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +order_t* +StoreAPI_placeOrder(apiClient_t *apiClient ,order_t * body) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = list_create(); + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/store/order") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/store/order"); + // create the path + long sizeOfPath = strlen("/store/order")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/store/order"); - // Body Param - cJSON *localVarSingleItemJSON_body; - if(body != NULL) { - // string - localVarSingleItemJSON_body = order_convertToJSON(body); - localVarBodyParameters = - cJSON_Print(localVarSingleItemJSON_body); - } - list_addElement(localVarHeaderType, "application/xml"); // produces - list_addElement(localVarHeaderType, "application/json"); // produces - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "POST"); + // Body Param + cJSON *localVarSingleItemJSON_body; + if (body != NULL) + { + //string + localVarSingleItemJSON_body = order_convertToJSON(body); + localVarBodyParameters = cJSON_Print(localVarSingleItemJSON_body); + } + list_addElement(localVarHeaderType,"application/xml"); //produces + list_addElement(localVarHeaderType,"application/json"); //produces + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "POST"); - if(apiClient->response_code == 200) { - printf("%s\n", "successful operation"); - } - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid Order"); - } - // nonprimitive not container - cJSON *StoreAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); - order_t *elementToReturn = order_parseFromJSON(StoreAPIlocalVarJSON); - cJSON_Delete(StoreAPIlocalVarJSON); - if(elementToReturn == NULL) { - // return 0; - } + if (apiClient->response_code == 200) { + printf("%s\n","successful operation"); + } + if (apiClient->response_code == 400) { + printf("%s\n","Invalid Order"); + } + //nonprimitive not container + cJSON *StoreAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); + order_t *elementToReturn = order_parseFromJSON(StoreAPIlocalVarJSON); + cJSON_Delete(StoreAPIlocalVarJSON); + if(elementToReturn == NULL) { + // return 0; + } - // return type - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } - - - - list_free(localVarHeaderType); - - free(localVarPath); - cJSON_Delete(localVarSingleItemJSON_body); - free(localVarBodyParameters); - return elementToReturn; + //return type + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + list_free(localVarHeaderType); + + free(localVarPath); + cJSON_Delete(localVarSingleItemJSON_body); + free(localVarBodyParameters); + return elementToReturn; end: - return NULL; + return NULL; + } + diff --git a/samples/client/petstore/c/api/StoreAPI.h b/samples/client/petstore/c/api/StoreAPI.h index 81d68528f1f..cba13a977d5 100644 --- a/samples/client/petstore/c/api/StoreAPI.h +++ b/samples/client/petstore/c/api/StoreAPI.h @@ -11,23 +11,29 @@ // // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors // -void StoreAPI_deleteOrder(apiClient_t *apiClient, char *orderId); +void +StoreAPI_deleteOrder(apiClient_t *apiClient ,char * orderId); // Returns pet inventories by status // // Returns a map of status codes to quantities // -list_t *StoreAPI_getInventory(apiClient_t *apiClient); +list_t* +StoreAPI_getInventory(apiClient_t *apiClient); // Find purchase order by ID // // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions // -order_t *StoreAPI_getOrderById(apiClient_t *apiClient, long orderId); +order_t* +StoreAPI_getOrderById(apiClient_t *apiClient ,long orderId); // Place an order for a pet // -order_t *StoreAPI_placeOrder(apiClient_t *apiClient, order_t *body); +order_t* +StoreAPI_placeOrder(apiClient_t *apiClient ,order_t * body); + + diff --git a/samples/client/petstore/c/api/UserAPI.c b/samples/client/petstore/c/api/UserAPI.c index 9170293951e..1656b4472bc 100644 --- a/samples/client/petstore/c/api/UserAPI.c +++ b/samples/client/petstore/c/api/UserAPI.c @@ -6,546 +6,566 @@ #define MAX_BUFFER_LENGTH 4096 #define intToStr(dst, src) \ - do { \ - char dst[256]; \ - snprintf(dst, 256, "%ld", (long int) (src)); \ - } while(0) + do {\ + char dst[256];\ + snprintf(dst, 256, "%ld", (long int)(src));\ +}while(0) // Create user // // This can only be done by the logged in user. // -void UserAPI_createUser(apiClient_t *apiClient, user_t *body) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +void +UserAPI_createUser(apiClient_t *apiClient ,user_t * body) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/user") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/user"); + // create the path + long sizeOfPath = strlen("/user")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/user"); - // Body Param - cJSON *localVarSingleItemJSON_body; - if(body != NULL) { - // string - localVarSingleItemJSON_body = user_convertToJSON(body); - localVarBodyParameters = - cJSON_Print(localVarSingleItemJSON_body); - } - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "POST"); + // Body Param + cJSON *localVarSingleItemJSON_body; + if (body != NULL) + { + //string + localVarSingleItemJSON_body = user_convertToJSON(body); + localVarBodyParameters = cJSON_Print(localVarSingleItemJSON_body); + } + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "POST"); - if(apiClient->response_code == 0) { - printf("%s\n", "successful operation"); - } - // No return type + if (apiClient->response_code == 0) { + printf("%s\n","successful operation"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + + + free(localVarPath); + cJSON_Delete(localVarSingleItemJSON_body); + free(localVarBodyParameters); - - - - - free(localVarPath); - cJSON_Delete(localVarSingleItemJSON_body); - free(localVarBodyParameters); } // Creates list of users with given input array // -void UserAPI_createUsersWithArrayInput(apiClient_t *apiClient, list_t *body) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +void +UserAPI_createUsersWithArrayInput(apiClient_t *apiClient ,list_t * body) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/user/createWithArray") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/user/createWithArray"); + // create the path + long sizeOfPath = strlen("/user/createWithArray")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/user/createWithArray"); - // Body Param - // notstring - cJSON *localVar_body; - cJSON *localVarItemJSON_body; - cJSON *localVarSingleItemJSON_body; - if(body != NULL) { - localVarItemJSON_body = cJSON_CreateObject(); - localVarSingleItemJSON_body = cJSON_AddArrayToObject( - localVarItemJSON_body, "body"); - if(localVarSingleItemJSON_body == NULL) { - // nonprimitive container + // Body Param + //notstring + cJSON *localVar_body; + cJSON *localVarItemJSON_body; + cJSON *localVarSingleItemJSON_body; + if (body != NULL) + { + localVarItemJSON_body = cJSON_CreateObject(); + localVarSingleItemJSON_body = cJSON_AddArrayToObject(localVarItemJSON_body, "body"); + if (localVarSingleItemJSON_body == NULL) + { + // nonprimitive container - goto end; - } - } + goto end; + } + } - listEntry_t *bodyBodyListEntry; - list_ForEach(bodyBodyListEntry, body) - { - localVar_body = user_convertToJSON(bodyBodyListEntry->data); - if(localVar_body == NULL) { - goto end; - } - cJSON_AddItemToArray(localVarSingleItemJSON_body, - localVar_body); - localVarBodyParameters = cJSON_Print(localVarItemJSON_body); - } - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "POST"); + listEntry_t *bodyBodyListEntry; + list_ForEach(bodyBodyListEntry, body) + { + localVar_body = user_convertToJSON(bodyBodyListEntry->data); + if(localVar_body == NULL) + { + goto end; + } + cJSON_AddItemToArray(localVarSingleItemJSON_body, localVar_body); + localVarBodyParameters = cJSON_Print(localVarItemJSON_body); + } + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "POST"); - if(apiClient->response_code == 0) { - printf("%s\n", "successful operation"); - } - // No return type + if (apiClient->response_code == 0) { + printf("%s\n","successful operation"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + + + free(localVarPath); + cJSON_Delete(localVarItemJSON_body); + cJSON_Delete(localVarSingleItemJSON_body); + cJSON_Delete(localVar_body); + free(localVarBodyParameters); - - - - - free(localVarPath); - cJSON_Delete(localVarItemJSON_body); - cJSON_Delete(localVarSingleItemJSON_body); - cJSON_Delete(localVar_body); - free(localVarBodyParameters); } // Creates list of users with given input array // -void UserAPI_createUsersWithListInput(apiClient_t *apiClient, list_t *body) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +void +UserAPI_createUsersWithListInput(apiClient_t *apiClient ,list_t * body) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/user/createWithList") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/user/createWithList"); + // create the path + long sizeOfPath = strlen("/user/createWithList")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/user/createWithList"); - // Body Param - // notstring - cJSON *localVar_body; - cJSON *localVarItemJSON_body; - cJSON *localVarSingleItemJSON_body; - if(body != NULL) { - localVarItemJSON_body = cJSON_CreateObject(); - localVarSingleItemJSON_body = cJSON_AddArrayToObject( - localVarItemJSON_body, "body"); - if(localVarSingleItemJSON_body == NULL) { - // nonprimitive container + // Body Param + //notstring + cJSON *localVar_body; + cJSON *localVarItemJSON_body; + cJSON *localVarSingleItemJSON_body; + if (body != NULL) + { + localVarItemJSON_body = cJSON_CreateObject(); + localVarSingleItemJSON_body = cJSON_AddArrayToObject(localVarItemJSON_body, "body"); + if (localVarSingleItemJSON_body == NULL) + { + // nonprimitive container - goto end; - } - } + goto end; + } + } - listEntry_t *bodyBodyListEntry; - list_ForEach(bodyBodyListEntry, body) - { - localVar_body = user_convertToJSON(bodyBodyListEntry->data); - if(localVar_body == NULL) { - goto end; - } - cJSON_AddItemToArray(localVarSingleItemJSON_body, - localVar_body); - localVarBodyParameters = cJSON_Print(localVarItemJSON_body); - } - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "POST"); + listEntry_t *bodyBodyListEntry; + list_ForEach(bodyBodyListEntry, body) + { + localVar_body = user_convertToJSON(bodyBodyListEntry->data); + if(localVar_body == NULL) + { + goto end; + } + cJSON_AddItemToArray(localVarSingleItemJSON_body, localVar_body); + localVarBodyParameters = cJSON_Print(localVarItemJSON_body); + } + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "POST"); - if(apiClient->response_code == 0) { - printf("%s\n", "successful operation"); - } - // No return type + if (apiClient->response_code == 0) { + printf("%s\n","successful operation"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + + + free(localVarPath); + cJSON_Delete(localVarItemJSON_body); + cJSON_Delete(localVarSingleItemJSON_body); + cJSON_Delete(localVar_body); + free(localVarBodyParameters); - - - - - free(localVarPath); - cJSON_Delete(localVarItemJSON_body); - cJSON_Delete(localVarSingleItemJSON_body); - cJSON_Delete(localVar_body); - free(localVarBodyParameters); } // Delete user // // This can only be done by the logged in user. // -void UserAPI_deleteUser(apiClient_t *apiClient, char *username) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +void +UserAPI_deleteUser(apiClient_t *apiClient ,char * username) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/user/{username}") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/user/{username}"); + // create the path + long sizeOfPath = strlen("/user/{username}")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/user/{username}"); - // Path Params - long sizeOfPathParams_username = strlen(username) + 3 + strlen( - "{ username }"); - if(username == NULL) { - goto end; - } - char *localVarToReplace_username = malloc(sizeOfPathParams_username); - sprintf(localVarToReplace_username, "{%s}", "username"); + // Path Params + long sizeOfPathParams_username = strlen(username)+3 + strlen("{ username }"); + if(username == NULL) { + goto end; + } + char* localVarToReplace_username = malloc(sizeOfPathParams_username); + sprintf(localVarToReplace_username, "{%s}", "username"); - localVarPath = strReplace(localVarPath, localVarToReplace_username, - username); + localVarPath = strReplace(localVarPath, localVarToReplace_username, username); - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "DELETE"); + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "DELETE"); - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid username supplied"); - } - if(apiClient->response_code == 404) { - printf("%s\n", "User not found"); - } - // No return type + if (apiClient->response_code == 400) { + printf("%s\n","Invalid username supplied"); + } + if (apiClient->response_code == 404) { + printf("%s\n","User not found"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + + + free(localVarPath); + free(localVarToReplace_username); - - - - - free(localVarPath); - free(localVarToReplace_username); } // Get user by user name // -user_t *UserAPI_getUserByName(apiClient_t *apiClient, char *username) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = list_create(); - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +user_t* +UserAPI_getUserByName(apiClient_t *apiClient ,char * username) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = list_create(); + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/user/{username}") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/user/{username}"); + // create the path + long sizeOfPath = strlen("/user/{username}")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/user/{username}"); - // Path Params - long sizeOfPathParams_username = strlen(username) + 3 + strlen( - "{ username }"); - if(username == NULL) { - goto end; - } - char *localVarToReplace_username = malloc(sizeOfPathParams_username); - sprintf(localVarToReplace_username, "{%s}", "username"); + // Path Params + long sizeOfPathParams_username = strlen(username)+3 + strlen("{ username }"); + if(username == NULL) { + goto end; + } + char* localVarToReplace_username = malloc(sizeOfPathParams_username); + sprintf(localVarToReplace_username, "{%s}", "username"); - localVarPath = strReplace(localVarPath, localVarToReplace_username, - username); + localVarPath = strReplace(localVarPath, localVarToReplace_username, username); - list_addElement(localVarHeaderType, "application/xml"); // produces - list_addElement(localVarHeaderType, "application/json"); // produces - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "GET"); + list_addElement(localVarHeaderType,"application/xml"); //produces + list_addElement(localVarHeaderType,"application/json"); //produces + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "GET"); - if(apiClient->response_code == 200) { - printf("%s\n", "successful operation"); - } - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid username supplied"); - } - if(apiClient->response_code == 404) { - printf("%s\n", "User not found"); - } - // nonprimitive not container - cJSON *UserAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); - user_t *elementToReturn = user_parseFromJSON(UserAPIlocalVarJSON); - cJSON_Delete(UserAPIlocalVarJSON); - if(elementToReturn == NULL) { - // return 0; - } + if (apiClient->response_code == 200) { + printf("%s\n","successful operation"); + } + if (apiClient->response_code == 400) { + printf("%s\n","Invalid username supplied"); + } + if (apiClient->response_code == 404) { + printf("%s\n","User not found"); + } + //nonprimitive not container + cJSON *UserAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); + user_t *elementToReturn = user_parseFromJSON(UserAPIlocalVarJSON); + cJSON_Delete(UserAPIlocalVarJSON); + if(elementToReturn == NULL) { + // return 0; + } - // return type - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } - - - - list_free(localVarHeaderType); - - free(localVarPath); - free(localVarToReplace_username); - return elementToReturn; + //return type + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + list_free(localVarHeaderType); + + free(localVarPath); + free(localVarToReplace_username); + return elementToReturn; end: - return NULL; + return NULL; + } // Logs user into the system // -char *UserAPI_loginUser(apiClient_t *apiClient, char *username, - char *password) { - list_t *localVarQueryParameters = list_create(); - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = list_create(); - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +char* +UserAPI_loginUser(apiClient_t *apiClient ,char * username ,char * password) +{ + list_t *localVarQueryParameters = list_create(); + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = list_create(); + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/user/login") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/user/login"); + // create the path + long sizeOfPath = strlen("/user/login")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/user/login"); - // query parameters - char *keyQuery_username; - char *valueQuery_username; - keyValuePair_t *keyPairQuery_username = 0; - if(username) { - keyQuery_username = strdup("username"); - valueQuery_username = strdup((username)); - keyPairQuery_username = keyValuePair_create(keyQuery_username, - valueQuery_username); - list_addElement(localVarQueryParameters, keyPairQuery_username); - } + // query parameters + char *keyQuery_username; + char * valueQuery_username; + keyValuePair_t *keyPairQuery_username = 0; + if (username) + { + keyQuery_username = strdup("username"); + valueQuery_username = strdup((username)); + keyPairQuery_username = keyValuePair_create(keyQuery_username, valueQuery_username); + list_addElement(localVarQueryParameters,keyPairQuery_username); + } - // query parameters - char *keyQuery_password; - char *valueQuery_password; - keyValuePair_t *keyPairQuery_password = 0; - if(password) { - keyQuery_password = strdup("password"); - valueQuery_password = strdup((password)); - keyPairQuery_password = keyValuePair_create(keyQuery_password, - valueQuery_password); - list_addElement(localVarQueryParameters, keyPairQuery_password); - } - list_addElement(localVarHeaderType, "application/xml"); // produces - list_addElement(localVarHeaderType, "application/json"); // produces - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "GET"); + // query parameters + char *keyQuery_password; + char * valueQuery_password; + keyValuePair_t *keyPairQuery_password = 0; + if (password) + { + keyQuery_password = strdup("password"); + valueQuery_password = strdup((password)); + keyPairQuery_password = keyValuePair_create(keyQuery_password, valueQuery_password); + list_addElement(localVarQueryParameters,keyPairQuery_password); + } + list_addElement(localVarHeaderType,"application/xml"); //produces + list_addElement(localVarHeaderType,"application/json"); //produces + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "GET"); - if(apiClient->response_code == 200) { - printf("%s\n", "successful operation"); - } - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid username/password supplied"); - } - // primitive reutrn type simple - char *elementToReturn = strdup((char *) apiClient->dataReceived); + if (apiClient->response_code == 200) { + printf("%s\n","successful operation"); + } + if (apiClient->response_code == 400) { + printf("%s\n","Invalid username/password supplied"); + } + //primitive reutrn type simple + char* elementToReturn = strdup((char*)apiClient->dataReceived); - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } - list_free(localVarQueryParameters); - - - list_free(localVarHeaderType); - - free(localVarPath); - free(keyQuery_username); - free(valueQuery_username); - keyValuePair_free(keyPairQuery_username); - free(keyQuery_password); - free(valueQuery_password); - keyValuePair_free(keyPairQuery_password); - return elementToReturn; + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + list_free(localVarQueryParameters); + + + list_free(localVarHeaderType); + + free(localVarPath); + free(keyQuery_username); + free(valueQuery_username); + keyValuePair_free(keyPairQuery_username); + free(keyQuery_password); + free(valueQuery_password); + keyValuePair_free(keyPairQuery_password); + return elementToReturn; end: - return NULL; + return NULL; + } // Logs out current logged in user session // -void UserAPI_logoutUser(apiClient_t *apiClient) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +void +UserAPI_logoutUser(apiClient_t *apiClient) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/user/logout") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/user/logout"); + // create the path + long sizeOfPath = strlen("/user/logout")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/user/logout"); - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "GET"); + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "GET"); - if(apiClient->response_code == 0) { - printf("%s\n", "successful operation"); - } - // No return type + if (apiClient->response_code == 0) { + printf("%s\n","successful operation"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + + + free(localVarPath); - - - - - free(localVarPath); } // Updated user // // This can only be done by the logged in user. // -void UserAPI_updateUser(apiClient_t *apiClient, char *username, user_t *body) { - list_t *localVarQueryParameters = NULL; - list_t *localVarHeaderParameters = NULL; - list_t *localVarFormParameters = NULL; - list_t *localVarHeaderType = NULL; - list_t *localVarContentType = NULL; - char *localVarBodyParameters = NULL; +void +UserAPI_updateUser(apiClient_t *apiClient ,char * username ,user_t * body) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = NULL; + list_t *localVarHeaderType = NULL; + list_t *localVarContentType = NULL; + char *localVarBodyParameters = NULL; - // create the path - long sizeOfPath = strlen("/user/{username}") + 1; - char *localVarPath = malloc(sizeOfPath); - snprintf(localVarPath, sizeOfPath, "/user/{username}"); + // create the path + long sizeOfPath = strlen("/user/{username}")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/user/{username}"); - // Path Params - long sizeOfPathParams_username = strlen(username) + 3 + strlen( - "{ username }"); - if(username == NULL) { - goto end; - } - char *localVarToReplace_username = malloc(sizeOfPathParams_username); - sprintf(localVarToReplace_username, "{%s}", "username"); + // Path Params + long sizeOfPathParams_username = strlen(username)+3 + strlen("{ username }"); + if(username == NULL) { + goto end; + } + char* localVarToReplace_username = malloc(sizeOfPathParams_username); + sprintf(localVarToReplace_username, "{%s}", "username"); - localVarPath = strReplace(localVarPath, localVarToReplace_username, - username); + localVarPath = strReplace(localVarPath, localVarToReplace_username, username); - // Body Param - cJSON *localVarSingleItemJSON_body; - if(body != NULL) { - // string - localVarSingleItemJSON_body = user_convertToJSON(body); - localVarBodyParameters = - cJSON_Print(localVarSingleItemJSON_body); - } - apiClient_invoke(apiClient, - localVarPath, - localVarQueryParameters, - localVarHeaderParameters, - localVarFormParameters, - localVarHeaderType, - localVarContentType, - localVarBodyParameters, - "PUT"); + // Body Param + cJSON *localVarSingleItemJSON_body; + if (body != NULL) + { + //string + localVarSingleItemJSON_body = user_convertToJSON(body); + localVarBodyParameters = cJSON_Print(localVarSingleItemJSON_body); + } + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + "PUT"); - if(apiClient->response_code == 400) { - printf("%s\n", "Invalid user supplied"); - } - if(apiClient->response_code == 404) { - printf("%s\n", "User not found"); - } - // No return type + if (apiClient->response_code == 400) { + printf("%s\n","Invalid user supplied"); + } + if (apiClient->response_code == 404) { + printf("%s\n","User not found"); + } + //No return type end: - if(apiClient->dataReceived) { - free(apiClient->dataReceived); - } + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + } + + + + + + free(localVarPath); + free(localVarToReplace_username); + cJSON_Delete(localVarSingleItemJSON_body); + free(localVarBodyParameters); - - - - - free(localVarPath); - free(localVarToReplace_username); - cJSON_Delete(localVarSingleItemJSON_body); - free(localVarBodyParameters); } + diff --git a/samples/client/petstore/c/api/UserAPI.h b/samples/client/petstore/c/api/UserAPI.h index c9475c2e55d..57f04a72194 100644 --- a/samples/client/petstore/c/api/UserAPI.h +++ b/samples/client/petstore/c/api/UserAPI.h @@ -11,43 +11,53 @@ // // This can only be done by the logged in user. // -void UserAPI_createUser(apiClient_t *apiClient, user_t *body); +void +UserAPI_createUser(apiClient_t *apiClient ,user_t * body); // Creates list of users with given input array // -void UserAPI_createUsersWithArrayInput(apiClient_t *apiClient, list_t *body); +void +UserAPI_createUsersWithArrayInput(apiClient_t *apiClient ,list_t * body); // Creates list of users with given input array // -void UserAPI_createUsersWithListInput(apiClient_t *apiClient, list_t *body); +void +UserAPI_createUsersWithListInput(apiClient_t *apiClient ,list_t * body); // Delete user // // This can only be done by the logged in user. // -void UserAPI_deleteUser(apiClient_t *apiClient, char *username); +void +UserAPI_deleteUser(apiClient_t *apiClient ,char * username); // Get user by user name // -user_t *UserAPI_getUserByName(apiClient_t *apiClient, char *username); +user_t* +UserAPI_getUserByName(apiClient_t *apiClient ,char * username); // Logs user into the system // -char *UserAPI_loginUser(apiClient_t *apiClient, char *username, char *password); +char* +UserAPI_loginUser(apiClient_t *apiClient ,char * username ,char * password); // Logs out current logged in user session // -void UserAPI_logoutUser(apiClient_t *apiClient); +void +UserAPI_logoutUser(apiClient_t *apiClient); // Updated user // // This can only be done by the logged in user. // -void UserAPI_updateUser(apiClient_t *apiClient, char *username, user_t *body); +void +UserAPI_updateUser(apiClient_t *apiClient ,char * username ,user_t * body); + + diff --git a/samples/client/petstore/c/external/cJSON.c b/samples/client/petstore/c/external/cJSON.c index 78b3ecfec6f..cbdec4132f1 100644 --- a/samples/client/petstore/c/external/cJSON.c +++ b/samples/client/petstore/c/external/cJSON.c @@ -1,31 +1,30 @@ /* - Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - */ + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ /* cJSON */ /* JSON parser in C. */ /* disable warnings about old C89 functions in MSVC */ -#if !defined(_CRT_SECURE_NO_DEPRECATE) && \ - defined(_MSC_VER) +#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) #define _CRT_SECURE_NO_DEPRECATE #endif @@ -59,85 +58,85 @@ #include "cJSON.h" /* define our own boolean type */ -#define true ((cJSON_bool) 1) -#define false ((cJSON_bool) 0) +#define true ((cJSON_bool)1) +#define false ((cJSON_bool)0) typedef struct { - const unsigned char *json; - size_t position; + const unsigned char *json; + size_t position; } error; static error global_error = { NULL, 0 }; CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void) { - return (const char *) (global_error.json + global_error.position); + return (const char*) (global_error.json + global_error.position); } -CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON * item) { - if(!cJSON_IsString(item)) { - return NULL; - } +CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) { + if (!cJSON_IsString(item)) { + return NULL; + } - return item->valuestring; + return item->valuestring; } /* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ -#if (CJSON_VERSION_MAJOR != 1) || \ - (CJSON_VERSION_MINOR != 7) || \ - (CJSON_VERSION_PATCH != 7) - #error \ - cJSON.h and cJSON.c have different versions. Make sure that both have the same. +#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 7) + #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. #endif -CJSON_PUBLIC(const char *) cJSON_Version(void) +CJSON_PUBLIC(const char*) cJSON_Version(void) { - static char version[15]; - sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, - CJSON_VERSION_PATCH); + static char version[15]; + sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); - return version; + return version; } /* Case insensitive string comparison, doesn't consider two NULL pointers equal though */ -static int case_insensitive_strcmp(const unsigned char *string1, - const unsigned char *string2) { - if((string1 == NULL) || - (string2 == NULL)) - { - return 1; - } +static int case_insensitive_strcmp(const unsigned char *string1, const unsigned char *string2) +{ + if ((string1 == NULL) || (string2 == NULL)) + { + return 1; + } - if(string1 == string2) { - return 0; - } + if (string1 == string2) + { + return 0; + } - for( ; tolower(*string1) == tolower(*string2); - (void) string1++, string2++) - { - if(*string1 == '\0') { - return 0; - } - } + for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++) + { + if (*string1 == '\0') + { + return 0; + } + } - return tolower(*string1) - tolower(*string2); + return tolower(*string1) - tolower(*string2); } -typedef struct internal_hooks { - void *(*allocate)(size_t size); - void (*deallocate)(void *pointer); - void *(*reallocate)(void *pointer, size_t size); +typedef struct internal_hooks +{ + void *(*allocate)(size_t size); + void (*deallocate)(void *pointer); + void *(*reallocate)(void *pointer, size_t size); } internal_hooks; #if defined(_MSC_VER) /* work around MSVC error C2322: '...' address of dillimport '...' is not static */ -static void *internal_malloc(size_t size) { - return malloc(size); +static void *internal_malloc(size_t size) +{ + return malloc(size); } -static void internal_free(void *pointer) { - free(pointer); +static void internal_free(void *pointer) +{ + free(pointer); } -static void *internal_realloc(void *pointer, size_t size) { - return realloc(pointer, size); +static void *internal_realloc(void *pointer, size_t size) +{ + return realloc(pointer, size); } #else #define internal_malloc malloc @@ -145,2711 +144,2789 @@ static void *internal_realloc(void *pointer, size_t size) { #define internal_realloc realloc #endif -static internal_hooks global_hooks = -{ internal_malloc, internal_free, internal_realloc }; +static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; -static unsigned char *cJSON_strdup(const unsigned char *string, - const internal_hooks *const hooks) { - size_t length = 0; - unsigned char *copy = NULL; +static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) +{ + size_t length = 0; + unsigned char *copy = NULL; - if(string == NULL) { - return NULL; - } + if (string == NULL) + { + return NULL; + } - length = strlen((const char *) string) + sizeof(""); - copy = (unsigned char *) hooks->allocate(length); - if(copy == NULL) { - return NULL; - } - memcpy(copy, string, length); + length = strlen((const char*)string) + sizeof(""); + copy = (unsigned char*)hooks->allocate(length); + if (copy == NULL) + { + return NULL; + } + memcpy(copy, string, length); - return copy; + return copy; } -CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks * hooks) +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) { - if(hooks == NULL) { - /* Reset hooks */ - global_hooks.allocate = malloc; - global_hooks.deallocate = free; - global_hooks.reallocate = realloc; - return; - } + if (hooks == NULL) + { + /* Reset hooks */ + global_hooks.allocate = malloc; + global_hooks.deallocate = free; + global_hooks.reallocate = realloc; + return; + } - global_hooks.allocate = malloc; - if(hooks->malloc_fn != NULL) { - global_hooks.allocate = hooks->malloc_fn; - } + global_hooks.allocate = malloc; + if (hooks->malloc_fn != NULL) + { + global_hooks.allocate = hooks->malloc_fn; + } - global_hooks.deallocate = free; - if(hooks->free_fn != NULL) { - global_hooks.deallocate = hooks->free_fn; - } + global_hooks.deallocate = free; + if (hooks->free_fn != NULL) + { + global_hooks.deallocate = hooks->free_fn; + } - /* use realloc only if both free and malloc are used */ - global_hooks.reallocate = NULL; - if((global_hooks.allocate == malloc) && - (global_hooks.deallocate == free)) - { - global_hooks.reallocate = realloc; - } + /* use realloc only if both free and malloc are used */ + global_hooks.reallocate = NULL; + if ((global_hooks.allocate == malloc) && (global_hooks.deallocate == free)) + { + global_hooks.reallocate = realloc; + } } /* Internal constructor. */ -static cJSON *cJSON_New_Item(const internal_hooks *const hooks) { - cJSON *node = (cJSON *) hooks->allocate(sizeof(cJSON)); - if(node) { - memset(node, '\0', sizeof(cJSON)); - } +static cJSON *cJSON_New_Item(const internal_hooks * const hooks) +{ + cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON)); + if (node) + { + memset(node, '\0', sizeof(cJSON)); + } - return node; + return node; } /* Delete a cJSON structure. */ -CJSON_PUBLIC(void) cJSON_Delete(cJSON * item) +CJSON_PUBLIC(void) cJSON_Delete(cJSON *item) { - cJSON *next = NULL; - while(item != NULL) { - next = item->next; - if(!(item->type & cJSON_IsReference) && - (item->child != NULL)) - { - cJSON_Delete(item->child); - } - if(!(item->type & cJSON_IsReference) && - (item->valuestring != NULL)) - { - global_hooks.deallocate(item->valuestring); - } - if(!(item->type & cJSON_StringIsConst) && - (item->string != NULL)) - { - global_hooks.deallocate(item->string); - } - global_hooks.deallocate(item); - item = next; - } + cJSON *next = NULL; + while (item != NULL) + { + next = item->next; + if (!(item->type & cJSON_IsReference) && (item->child != NULL)) + { + cJSON_Delete(item->child); + } + if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL)) + { + global_hooks.deallocate(item->valuestring); + } + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + global_hooks.deallocate(item->string); + } + global_hooks.deallocate(item); + item = next; + } } /* get the decimal point character of the current locale */ -static unsigned char get_decimal_point(void) { +static unsigned char get_decimal_point(void) +{ #ifdef ENABLE_LOCALES - struct lconv *lconv = localeconv(); - return (unsigned char) lconv->decimal_point[0]; + struct lconv *lconv = localeconv(); + return (unsigned char) lconv->decimal_point[0]; #else - return '.'; + return '.'; #endif } -typedef struct { - const unsigned char *content; - size_t length; - size_t offset; - size_t depth; /* How deeply nested (in arrays/objects) is the input at the current offset. */ - internal_hooks hooks; +typedef struct +{ + const unsigned char *content; + size_t length; + size_t offset; + size_t depth; /* How deeply nested (in arrays/objects) is the input at the current offset. */ + internal_hooks hooks; } parse_buffer; /* check if the given size is left to read in a given parse buffer (starting with 1) */ -#define can_read(buffer, size) ((buffer != NULL) && \ - (((buffer)->offset + size) <= (buffer)->length)) +#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length)) /* check if the buffer can be accessed at the given index (starting with 0) */ -#define can_access_at_index(buffer, index) ((buffer != NULL) && \ - (((buffer)->offset + index) < \ - (buffer)->length)) -#define cannot_access_at_index(buffer, \ - index) (!can_access_at_index(buffer, index)) +#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length)) +#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index)) /* get a pointer to the buffer at the position */ #define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset) /* Parse the input text to generate a number, and populate the result into item. */ -static cJSON_bool parse_number(cJSON *const item, - parse_buffer *const input_buffer) { - double number = 0; - unsigned char *after_end = NULL; - unsigned char number_c_string[64]; - unsigned char decimal_point = get_decimal_point(); - size_t i = 0; +static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_buffer) +{ + double number = 0; + unsigned char *after_end = NULL; + unsigned char number_c_string[64]; + unsigned char decimal_point = get_decimal_point(); + size_t i = 0; - if((input_buffer == NULL) || - (input_buffer->content == NULL)) - { - return false; - } + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; + } - /* copy the number into a temporary buffer and replace '.' with the decimal point - * of the current locale (for strtod) - * This also takes care of '\0' not necessarily being available for marking the end of the input */ - for(i = 0; (i < (sizeof(number_c_string) - 1)) && - can_access_at_index(input_buffer, i); i++) - { - switch(buffer_at_offset(input_buffer)[i]) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '+': - case '-': - case 'e': - case 'E': - number_c_string[i] = buffer_at_offset(input_buffer)[i]; - break; + /* copy the number into a temporary buffer and replace '.' with the decimal point + * of the current locale (for strtod) + * This also takes care of '\0' not necessarily being available for marking the end of the input */ + for (i = 0; (i < (sizeof(number_c_string) - 1)) && can_access_at_index(input_buffer, i); i++) + { + switch (buffer_at_offset(input_buffer)[i]) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '+': + case '-': + case 'e': + case 'E': + number_c_string[i] = buffer_at_offset(input_buffer)[i]; + break; - case '.': - number_c_string[i] = decimal_point; - break; + case '.': + number_c_string[i] = decimal_point; + break; - default: - goto loop_end; - } - } + default: + goto loop_end; + } + } loop_end: - number_c_string[i] = '\0'; + number_c_string[i] = '\0'; - number = strtod((const char *) number_c_string, (char **) &after_end); - if(number_c_string == after_end) { - return false; /* parse_error */ - } + number = strtod((const char*)number_c_string, (char**)&after_end); + if (number_c_string == after_end) + { + return false; /* parse_error */ + } - item->valuedouble = number; + item->valuedouble = number; - /* use saturation in case of overflow */ - if(number >= INT_MAX) { - item->valueint = INT_MAX; - } else if(number <= INT_MIN) { - item->valueint = INT_MIN; - } else { - item->valueint = (int) number; - } + /* use saturation in case of overflow */ + if (number >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (number <= INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)number; + } - item->type = cJSON_Number; + item->type = cJSON_Number; - input_buffer->offset += (size_t) (after_end - number_c_string); - return true; + input_buffer->offset += (size_t)(after_end - number_c_string); + return true; } /* don't ask me, but the original cJSON_SetNumberValue returns an integer or double */ -CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON * object, double number) +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number) { - if(number >= INT_MAX) { - object->valueint = INT_MAX; - } else if(number <= INT_MIN) { - object->valueint = INT_MIN; - } else { - object->valueint = (int) number; - } + if (number >= INT_MAX) + { + object->valueint = INT_MAX; + } + else if (number <= INT_MIN) + { + object->valueint = INT_MIN; + } + else + { + object->valueint = (int)number; + } - return object->valuedouble = number; + return object->valuedouble = number; } -typedef struct { - unsigned char *buffer; - size_t length; - size_t offset; - size_t depth; /* current nesting depth (for formatted printing) */ - cJSON_bool noalloc; - cJSON_bool format; /* is this print a formatted print */ - internal_hooks hooks; +typedef struct +{ + unsigned char *buffer; + size_t length; + size_t offset; + size_t depth; /* current nesting depth (for formatted printing) */ + cJSON_bool noalloc; + cJSON_bool format; /* is this print a formatted print */ + internal_hooks hooks; } printbuffer; /* realloc printbuffer if necessary to have at least "needed" bytes more */ -static unsigned char *ensure(printbuffer *const p, size_t needed) { - unsigned char *newbuffer = NULL; - size_t newsize = 0; +static unsigned char* ensure(printbuffer * const p, size_t needed) +{ + unsigned char *newbuffer = NULL; + size_t newsize = 0; - if((p == NULL) || - (p->buffer == NULL)) - { - return NULL; - } + if ((p == NULL) || (p->buffer == NULL)) + { + return NULL; + } - if((p->length > 0) && - (p->offset >= p->length)) - { - /* make sure that offset is valid */ - return NULL; - } + if ((p->length > 0) && (p->offset >= p->length)) + { + /* make sure that offset is valid */ + return NULL; + } - if(needed > INT_MAX) { - /* sizes bigger than INT_MAX are currently not supported */ - return NULL; - } + if (needed > INT_MAX) + { + /* sizes bigger than INT_MAX are currently not supported */ + return NULL; + } - needed += p->offset + 1; - if(needed <= p->length) { - return p->buffer + p->offset; - } + needed += p->offset + 1; + if (needed <= p->length) + { + return p->buffer + p->offset; + } - if(p->noalloc) { - return NULL; - } + if (p->noalloc) { + return NULL; + } - /* calculate new buffer size */ - if(needed > (INT_MAX / 2)) { - /* overflow of int, use INT_MAX if possible */ - if(needed <= INT_MAX) { - newsize = INT_MAX; - } else { - return NULL; - } - } else { - newsize = needed * 2; - } + /* calculate new buffer size */ + if (needed > (INT_MAX / 2)) + { + /* overflow of int, use INT_MAX if possible */ + if (needed <= INT_MAX) + { + newsize = INT_MAX; + } + else + { + return NULL; + } + } + else + { + newsize = needed * 2; + } - if(p->hooks.reallocate != NULL) { - /* reallocate with realloc if available */ - newbuffer = (unsigned char *) p->hooks.reallocate(p->buffer, - newsize); - if(newbuffer == NULL) { - p->hooks.deallocate(p->buffer); - p->length = 0; - p->buffer = NULL; + if (p->hooks.reallocate != NULL) + { + /* reallocate with realloc if available */ + newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize); + if (newbuffer == NULL) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; - return NULL; - } - } else { - /* otherwise reallocate manually */ - newbuffer = (unsigned char *) p->hooks.allocate(newsize); - if(!newbuffer) { - p->hooks.deallocate(p->buffer); - p->length = 0; - p->buffer = NULL; + return NULL; + } + } + else + { + /* otherwise reallocate manually */ + newbuffer = (unsigned char*)p->hooks.allocate(newsize); + if (!newbuffer) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; - return NULL; - } - if(newbuffer) { - memcpy(newbuffer, p->buffer, p->offset + 1); - } - p->hooks.deallocate(p->buffer); - } - p->length = newsize; - p->buffer = newbuffer; + return NULL; + } + if (newbuffer) + { + memcpy(newbuffer, p->buffer, p->offset + 1); + } + p->hooks.deallocate(p->buffer); + } + p->length = newsize; + p->buffer = newbuffer; - return newbuffer + p->offset; + return newbuffer + p->offset; } /* calculate the new length of the string in a printbuffer and update the offset */ -static void update_offset(printbuffer *const buffer) { - const unsigned char *buffer_pointer = NULL; - if((buffer == NULL) || - (buffer->buffer == NULL)) - { - return; - } - buffer_pointer = buffer->buffer + buffer->offset; +static void update_offset(printbuffer * const buffer) +{ + const unsigned char *buffer_pointer = NULL; + if ((buffer == NULL) || (buffer->buffer == NULL)) + { + return; + } + buffer_pointer = buffer->buffer + buffer->offset; - buffer->offset += strlen((const char *) buffer_pointer); + buffer->offset += strlen((const char*)buffer_pointer); } /* Render the number nicely from the given item into a string. */ -static cJSON_bool print_number(const cJSON *const item, - printbuffer *const output_buffer) { - unsigned char *output_pointer = NULL; - double d = item->valuedouble; - int length = 0; - size_t i = 0; - unsigned char number_buffer[26]; /* temporary buffer to print the number into */ - unsigned char decimal_point = get_decimal_point(); - double test; +static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + double d = item->valuedouble; + int length = 0; + size_t i = 0; + unsigned char number_buffer[26]; /* temporary buffer to print the number into */ + unsigned char decimal_point = get_decimal_point(); + double test; - if(output_buffer == NULL) { - return false; - } + if (output_buffer == NULL) + { + return false; + } - /* This checks for NaN and Infinity */ - if((d * 0) != 0) { - length = sprintf((char *) number_buffer, "null"); - } else { - /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */ - length = sprintf((char *) number_buffer, "%1.15g", d); + /* This checks for NaN and Infinity */ + if ((d * 0) != 0) + { + length = sprintf((char*)number_buffer, "null"); + } + else + { + /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */ + length = sprintf((char*)number_buffer, "%1.15g", d); - /* Check whether the original double can be recovered */ - if((sscanf((char *) number_buffer, "%lg", &test) != 1) || - ((double) test != d)) - { - /* If not, print with 17 decimal places of precision */ - length = sprintf((char *) number_buffer, "%1.17g", d); - } - } + /* Check whether the original double can be recovered */ + if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || ((double)test != d)) + { + /* If not, print with 17 decimal places of precision */ + length = sprintf((char*)number_buffer, "%1.17g", d); + } + } - /* sprintf failed or buffer overrun occured */ - if((length < 0) || - (length > (int) (sizeof(number_buffer) - 1))) - { - return false; - } + /* sprintf failed or buffer overrun occured */ + if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1))) + { + return false; + } - /* reserve appropriate space in the output */ - output_pointer = ensure(output_buffer, (size_t) length + sizeof("")); - if(output_pointer == NULL) { - return false; - } + /* reserve appropriate space in the output */ + output_pointer = ensure(output_buffer, (size_t)length + sizeof("")); + if (output_pointer == NULL) + { + return false; + } - /* copy the printed number to the output and replace locale - * dependent decimal point with '.' */ - for(i = 0; i < ((size_t) length); i++) { - if(number_buffer[i] == decimal_point) { - output_pointer[i] = '.'; - continue; - } + /* copy the printed number to the output and replace locale + * dependent decimal point with '.' */ + for (i = 0; i < ((size_t)length); i++) + { + if (number_buffer[i] == decimal_point) + { + output_pointer[i] = '.'; + continue; + } - output_pointer[i] = number_buffer[i]; - } - output_pointer[i] = '\0'; + output_pointer[i] = number_buffer[i]; + } + output_pointer[i] = '\0'; - output_buffer->offset += (size_t) length; + output_buffer->offset += (size_t)length; - return true; + return true; } /* parse 4 digit hexadecimal number */ -static unsigned parse_hex4(const unsigned char *const input) { - unsigned int h = 0; - size_t i = 0; +static unsigned parse_hex4(const unsigned char * const input) +{ + unsigned int h = 0; + size_t i = 0; - for(i = 0; i < 4; i++) { - /* parse digit */ - if((input[i] >= '0') && - (input[i] <= '9')) - { - h += (unsigned int) input[i] - '0'; - } else if((input[i] >= 'A') && - (input[i] <= 'F')) - { - h += (unsigned int) 10 + input[i] - 'A'; - } else if((input[i] >= 'a') && - (input[i] <= 'f')) - { - h += (unsigned int) 10 + input[i] - 'a'; - } else { /* invalid */ - return 0; - } + for (i = 0; i < 4; i++) + { + /* parse digit */ + if ((input[i] >= '0') && (input[i] <= '9')) + { + h += (unsigned int) input[i] - '0'; + } + else if ((input[i] >= 'A') && (input[i] <= 'F')) + { + h += (unsigned int) 10 + input[i] - 'A'; + } + else if ((input[i] >= 'a') && (input[i] <= 'f')) + { + h += (unsigned int) 10 + input[i] - 'a'; + } + else /* invalid */ + { + return 0; + } - if(i < 3) { - /* shift left to make place for the next nibble */ - h = h << 4; - } - } + if (i < 3) + { + /* shift left to make place for the next nibble */ + h = h << 4; + } + } - return h; + return h; } /* converts a UTF-16 literal to UTF-8 * A literal can be one or two sequences of the form \uXXXX */ -static unsigned char utf16_literal_to_utf8( - const unsigned char *const input_pointer, - const unsigned char *const input_end, unsigned char **output_pointer) { - long unsigned int codepoint = 0; - unsigned int first_code = 0; - const unsigned char *first_sequence = input_pointer; - unsigned char utf8_length = 0; - unsigned char utf8_position = 0; - unsigned char sequence_length = 0; - unsigned char first_byte_mark = 0; +static unsigned char utf16_literal_to_utf8(const unsigned char * const input_pointer, const unsigned char * const input_end, unsigned char **output_pointer) +{ + long unsigned int codepoint = 0; + unsigned int first_code = 0; + const unsigned char *first_sequence = input_pointer; + unsigned char utf8_length = 0; + unsigned char utf8_position = 0; + unsigned char sequence_length = 0; + unsigned char first_byte_mark = 0; - if((input_end - first_sequence) < 6) { - /* input ends unexpectedly */ - goto fail; - } + if ((input_end - first_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } - /* get the first utf16 sequence */ - first_code = parse_hex4(first_sequence + 2); + /* get the first utf16 sequence */ + first_code = parse_hex4(first_sequence + 2); - /* check that the code is valid */ - if(((first_code >= 0xDC00) && - (first_code <= 0xDFFF))) - { - goto fail; - } + /* check that the code is valid */ + if (((first_code >= 0xDC00) && (first_code <= 0xDFFF))) + { + goto fail; + } - /* UTF16 surrogate pair */ - if((first_code >= 0xD800) && - (first_code <= 0xDBFF)) - { - const unsigned char *second_sequence = first_sequence + 6; - unsigned int second_code = 0; - sequence_length = 12; /* \uXXXX\uXXXX */ + /* UTF16 surrogate pair */ + if ((first_code >= 0xD800) && (first_code <= 0xDBFF)) + { + const unsigned char *second_sequence = first_sequence + 6; + unsigned int second_code = 0; + sequence_length = 12; /* \uXXXX\uXXXX */ - if((input_end - second_sequence) < 6) { - /* input ends unexpectedly */ - goto fail; - } + if ((input_end - second_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } - if((second_sequence[0] != '\\') || - (second_sequence[1] != 'u')) - { - /* missing second half of the surrogate pair */ - goto fail; - } + if ((second_sequence[0] != '\\') || (second_sequence[1] != 'u')) + { + /* missing second half of the surrogate pair */ + goto fail; + } - /* get the second utf16 sequence */ - second_code = parse_hex4(second_sequence + 2); - /* check that the code is valid */ - if((second_code < 0xDC00) || - (second_code > 0xDFFF)) - { - /* invalid second half of the surrogate pair */ - goto fail; - } + /* get the second utf16 sequence */ + second_code = parse_hex4(second_sequence + 2); + /* check that the code is valid */ + if ((second_code < 0xDC00) || (second_code > 0xDFFF)) + { + /* invalid second half of the surrogate pair */ + goto fail; + } - /* calculate the unicode codepoint from the surrogate pair */ - codepoint = 0x10000 + - (((first_code & 0x3FF) << 10) | - (second_code & 0x3FF)); - } else { - sequence_length = 6; /* \uXXXX */ - codepoint = first_code; - } + /* calculate the unicode codepoint from the surrogate pair */ + codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF)); + } + else + { + sequence_length = 6; /* \uXXXX */ + codepoint = first_code; + } - /* encode as UTF-8 - * takes at maximum 4 bytes to encode: - * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ - if(codepoint < 0x80) { - /* normal ascii, encoding 0xxxxxxx */ - utf8_length = 1; - } else if(codepoint < 0x800) { - /* two bytes, encoding 110xxxxx 10xxxxxx */ - utf8_length = 2; - first_byte_mark = 0xC0; /* 11000000 */ - } else if(codepoint < 0x10000) { - /* three bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx */ - utf8_length = 3; - first_byte_mark = 0xE0; /* 11100000 */ - } else if(codepoint <= 0x10FFFF) { - /* four bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx */ - utf8_length = 4; - first_byte_mark = 0xF0; /* 11110000 */ - } else { - /* invalid unicode codepoint */ - goto fail; - } + /* encode as UTF-8 + * takes at maximum 4 bytes to encode: + * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + if (codepoint < 0x80) + { + /* normal ascii, encoding 0xxxxxxx */ + utf8_length = 1; + } + else if (codepoint < 0x800) + { + /* two bytes, encoding 110xxxxx 10xxxxxx */ + utf8_length = 2; + first_byte_mark = 0xC0; /* 11000000 */ + } + else if (codepoint < 0x10000) + { + /* three bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx */ + utf8_length = 3; + first_byte_mark = 0xE0; /* 11100000 */ + } + else if (codepoint <= 0x10FFFF) + { + /* four bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + utf8_length = 4; + first_byte_mark = 0xF0; /* 11110000 */ + } + else + { + /* invalid unicode codepoint */ + goto fail; + } - /* encode as utf8 */ - for(utf8_position = - (unsigned char) (utf8_length - 1); utf8_position > 0; - utf8_position--) { - /* 10xxxxxx */ - (*output_pointer)[utf8_position] = - (unsigned char) ((codepoint | 0x80) & 0xBF); - codepoint >>= 6; - } - /* encode first byte */ - if(utf8_length > 1) { - (*output_pointer)[0] = - (unsigned char) ((codepoint | first_byte_mark) & 0xFF); - } else { - (*output_pointer)[0] = (unsigned char) (codepoint & 0x7F); - } + /* encode as utf8 */ + for (utf8_position = (unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--) + { + /* 10xxxxxx */ + (*output_pointer)[utf8_position] = (unsigned char)((codepoint | 0x80) & 0xBF); + codepoint >>= 6; + } + /* encode first byte */ + if (utf8_length > 1) + { + (*output_pointer)[0] = (unsigned char)((codepoint | first_byte_mark) & 0xFF); + } + else + { + (*output_pointer)[0] = (unsigned char)(codepoint & 0x7F); + } - *output_pointer += utf8_length; + *output_pointer += utf8_length; - return sequence_length; + return sequence_length; fail: - return 0; + return 0; } /* Parse the input text into an unescaped cinput, and populate item. */ -static cJSON_bool parse_string(cJSON *const item, - parse_buffer *const input_buffer) { - const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1; - const unsigned char *input_end = buffer_at_offset(input_buffer) + 1; - unsigned char *output_pointer = NULL; - unsigned char *output = NULL; +static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_buffer) +{ + const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1; + const unsigned char *input_end = buffer_at_offset(input_buffer) + 1; + unsigned char *output_pointer = NULL; + unsigned char *output = NULL; - /* not a string */ - if(buffer_at_offset(input_buffer)[0] != '\"') { - goto fail; - } + /* not a string */ + if (buffer_at_offset(input_buffer)[0] != '\"') + { + goto fail; + } - { - /* calculate approximate size of the output (overestimate) */ - size_t allocation_length = 0; - size_t skipped_bytes = 0; - while(((size_t) (input_end - input_buffer->content) < - input_buffer->length) && - (*input_end != '\"')) - { - /* is escape sequence */ - if(input_end[0] == '\\') { - if((size_t) (input_end + 1 - - input_buffer->content) >= - input_buffer->length) { - /* prevent buffer overflow when last input character is a backslash */ - goto fail; - } - skipped_bytes++; - input_end++; - } - input_end++; - } - if(((size_t) (input_end - input_buffer->content) >= - input_buffer->length) || - (*input_end != '\"')) - { - goto fail; /* string ended unexpectedly */ - } + { + /* calculate approximate size of the output (overestimate) */ + size_t allocation_length = 0; + size_t skipped_bytes = 0; + while (((size_t)(input_end - input_buffer->content) < input_buffer->length) && (*input_end != '\"')) + { + /* is escape sequence */ + if (input_end[0] == '\\') + { + if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length) + { + /* prevent buffer overflow when last input character is a backslash */ + goto fail; + } + skipped_bytes++; + input_end++; + } + input_end++; + } + if (((size_t)(input_end - input_buffer->content) >= input_buffer->length) || (*input_end != '\"')) + { + goto fail; /* string ended unexpectedly */ + } - /* This is at most how much we need for the output */ - allocation_length = - (size_t) (input_end - buffer_at_offset(input_buffer)) - - skipped_bytes; - output = (unsigned char *) input_buffer->hooks.allocate( - allocation_length + sizeof("")); - if(output == NULL) { - goto fail; /* allocation failure */ - } - } + /* This is at most how much we need for the output */ + allocation_length = (size_t) (input_end - buffer_at_offset(input_buffer)) - skipped_bytes; + output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof("")); + if (output == NULL) + { + goto fail; /* allocation failure */ + } + } - output_pointer = output; - /* loop through the string literal */ - while(input_pointer < input_end) { - if(*input_pointer != '\\') { - *output_pointer++ = *input_pointer++; - } - /* escape sequence */ - else { - unsigned char sequence_length = 2; - if((input_end - input_pointer) < 1) { - goto fail; - } + output_pointer = output; + /* loop through the string literal */ + while (input_pointer < input_end) + { + if (*input_pointer != '\\') + { + *output_pointer++ = *input_pointer++; + } + /* escape sequence */ + else + { + unsigned char sequence_length = 2; + if ((input_end - input_pointer) < 1) + { + goto fail; + } - switch(input_pointer[1]) { - case 'b': - *output_pointer++ = '\b'; - break; + switch (input_pointer[1]) + { + case 'b': + *output_pointer++ = '\b'; + break; + case 'f': + *output_pointer++ = '\f'; + break; + case 'n': + *output_pointer++ = '\n'; + break; + case 'r': + *output_pointer++ = '\r'; + break; + case 't': + *output_pointer++ = '\t'; + break; + case '\"': + case '\\': + case '/': + *output_pointer++ = input_pointer[1]; + break; - case 'f': - *output_pointer++ = '\f'; - break; + /* UTF-16 literal */ + case 'u': + sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer); + if (sequence_length == 0) + { + /* failed to convert UTF16-literal to UTF-8 */ + goto fail; + } + break; - case 'n': - *output_pointer++ = '\n'; - break; + default: + goto fail; + } + input_pointer += sequence_length; + } + } - case 'r': - *output_pointer++ = '\r'; - break; + /* zero terminate the output */ + *output_pointer = '\0'; - case 't': - *output_pointer++ = '\t'; - break; + item->type = cJSON_String; + item->valuestring = (char*)output; - case '\"': - case '\\': - case '/': - *output_pointer++ = input_pointer[1]; - break; + input_buffer->offset = (size_t) (input_end - input_buffer->content); + input_buffer->offset++; - /* UTF-16 literal */ - case 'u': - sequence_length = utf16_literal_to_utf8( - input_pointer, input_end, - &output_pointer); - if(sequence_length == 0) { - /* failed to convert UTF16-literal to UTF-8 */ - goto fail; - } - break; - - default: - goto fail; - } - input_pointer += sequence_length; - } - } - - /* zero terminate the output */ - *output_pointer = '\0'; - - item->type = cJSON_String; - item->valuestring = (char *) output; - - input_buffer->offset = (size_t) (input_end - input_buffer->content); - input_buffer->offset++; - - return true; + return true; fail: - if(output != NULL) { - input_buffer->hooks.deallocate(output); - } + if (output != NULL) + { + input_buffer->hooks.deallocate(output); + } - if(input_pointer != NULL) { - input_buffer->offset = - (size_t) (input_pointer - input_buffer->content); - } + if (input_pointer != NULL) + { + input_buffer->offset = (size_t)(input_pointer - input_buffer->content); + } - return false; + return false; } /* Render the cstring provided to an escaped version that can be printed. */ -static cJSON_bool print_string_ptr(const unsigned char *const input, - printbuffer *const output_buffer) { - const unsigned char *input_pointer = NULL; - unsigned char *output = NULL; - unsigned char *output_pointer = NULL; - size_t output_length = 0; - /* numbers of additional characters needed for escaping */ - size_t escape_characters = 0; +static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer) +{ + const unsigned char *input_pointer = NULL; + unsigned char *output = NULL; + unsigned char *output_pointer = NULL; + size_t output_length = 0; + /* numbers of additional characters needed for escaping */ + size_t escape_characters = 0; - if(output_buffer == NULL) { - return false; - } + if (output_buffer == NULL) + { + return false; + } - /* empty string */ - if(input == NULL) { - output = ensure(output_buffer, sizeof("\"\"")); - if(output == NULL) { - return false; - } - strcpy((char *) output, "\"\""); + /* empty string */ + if (input == NULL) + { + output = ensure(output_buffer, sizeof("\"\"")); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "\"\""); - return true; - } + return true; + } - /* set "flag" to 1 if something needs to be escaped */ - for(input_pointer = input; *input_pointer; input_pointer++) { - switch(*input_pointer) { - case '\"': - case '\\': - case '\b': - case '\f': - case '\n': - case '\r': - case '\t': - /* one character escape sequence */ - escape_characters++; - break; + /* set "flag" to 1 if something needs to be escaped */ + for (input_pointer = input; *input_pointer; input_pointer++) + { + switch (*input_pointer) + { + case '\"': + case '\\': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + /* one character escape sequence */ + escape_characters++; + break; + default: + if (*input_pointer < 32) + { + /* UTF-16 escape sequence uXXXX */ + escape_characters += 5; + } + break; + } + } + output_length = (size_t)(input_pointer - input) + escape_characters; - default: - if(*input_pointer < 32) { - /* UTF-16 escape sequence uXXXX */ - escape_characters += 5; - } - break; - } - } - output_length = (size_t) (input_pointer - input) + escape_characters; + output = ensure(output_buffer, output_length + sizeof("\"\"")); + if (output == NULL) + { + return false; + } - output = ensure(output_buffer, output_length + sizeof("\"\"")); - if(output == NULL) { - return false; - } + /* no characters have to be escaped */ + if (escape_characters == 0) + { + output[0] = '\"'; + memcpy(output + 1, input, output_length); + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; - /* no characters have to be escaped */ - if(escape_characters == 0) { - output[0] = '\"'; - memcpy(output + 1, input, output_length); - output[output_length + 1] = '\"'; - output[output_length + 2] = '\0'; + return true; + } - return true; - } + output[0] = '\"'; + output_pointer = output + 1; + /* copy the string */ + for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++) + { + if ((*input_pointer > 31) && (*input_pointer != '\"') && (*input_pointer != '\\')) + { + /* normal character, copy */ + *output_pointer = *input_pointer; + } + else + { + /* character needs to be escaped */ + *output_pointer++ = '\\'; + switch (*input_pointer) + { + case '\\': + *output_pointer = '\\'; + break; + case '\"': + *output_pointer = '\"'; + break; + case '\b': + *output_pointer = 'b'; + break; + case '\f': + *output_pointer = 'f'; + break; + case '\n': + *output_pointer = 'n'; + break; + case '\r': + *output_pointer = 'r'; + break; + case '\t': + *output_pointer = 't'; + break; + default: + /* escape and print as unicode codepoint */ + sprintf((char*)output_pointer, "u%04x", *input_pointer); + output_pointer += 4; + break; + } + } + } + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; - output[0] = '\"'; - output_pointer = output + 1; - /* copy the string */ - for(input_pointer = input; *input_pointer != '\0'; - (void) input_pointer++, output_pointer++) { - if((*input_pointer > 31) && - (*input_pointer != '\"') && - (*input_pointer != '\\')) - { - /* normal character, copy */ - *output_pointer = *input_pointer; - } else { - /* character needs to be escaped */ - *output_pointer++ = '\\'; - switch(*input_pointer) { - case '\\': - *output_pointer = '\\'; - break; - - case '\"': - *output_pointer = '\"'; - break; - - case '\b': - *output_pointer = 'b'; - break; - - case '\f': - *output_pointer = 'f'; - break; - - case '\n': - *output_pointer = 'n'; - break; - - case '\r': - *output_pointer = 'r'; - break; - - case '\t': - *output_pointer = 't'; - break; - - default: - /* escape and print as unicode codepoint */ - sprintf((char *) output_pointer, "u%04x", - *input_pointer); - output_pointer += 4; - break; - } - } - } - output[output_length + 1] = '\"'; - output[output_length + 2] = '\0'; - - return true; + return true; } /* Invoke print_string_ptr (which is useful) on an item. */ -static cJSON_bool print_string(const cJSON *const item, printbuffer *const p) { - return print_string_ptr((unsigned char *) item->valuestring, p); +static cJSON_bool print_string(const cJSON * const item, printbuffer * const p) +{ + return print_string_ptr((unsigned char*)item->valuestring, p); } /* Predeclare these prototypes. */ -static cJSON_bool parse_value(cJSON *const item, - parse_buffer *const input_buffer); -static cJSON_bool print_value(const cJSON *const item, - printbuffer *const output_buffer); -static cJSON_bool parse_array(cJSON *const item, - parse_buffer *const input_buffer); -static cJSON_bool print_array(const cJSON *const item, - printbuffer *const output_buffer); -static cJSON_bool parse_object(cJSON *const item, - parse_buffer *const input_buffer); -static cJSON_bool print_object(const cJSON *const item, - printbuffer *const output_buffer); +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer); /* Utility to jump whitespace and cr/lf */ -static parse_buffer *buffer_skip_whitespace(parse_buffer *const buffer) { - if((buffer == NULL) || - (buffer->content == NULL)) - { - return NULL; - } +static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL)) + { + return NULL; + } - while(can_access_at_index(buffer, 0) && - (buffer_at_offset(buffer)[0] <= 32)) - { - buffer->offset++; - } + while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32)) + { + buffer->offset++; + } - if(buffer->offset == buffer->length) { - buffer->offset--; - } + if (buffer->offset == buffer->length) + { + buffer->offset--; + } - return buffer; + return buffer; } /* skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */ -static parse_buffer *skip_utf8_bom(parse_buffer *const buffer) { - if((buffer == NULL) || - (buffer->content == NULL) || - (buffer->offset != 0)) - { - return NULL; - } +static parse_buffer *skip_utf8_bom(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0)) + { + return NULL; + } - if(can_access_at_index(buffer, 4) && - (strncmp((const char *) buffer_at_offset(buffer), "\xEF\xBB\xBF", - 3) == 0)) - { - buffer->offset += 3; - } + if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0)) + { + buffer->offset += 3; + } - return buffer; + return buffer; } /* Parse an object - create a new root, and populate. */ -CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, - const char **return_parse_end, - cJSON_bool require_null_terminated) +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) { - parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; - cJSON *item = NULL; + parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; + cJSON *item = NULL; - /* reset error position */ - global_error.json = NULL; - global_error.position = 0; + /* reset error position */ + global_error.json = NULL; + global_error.position = 0; - if(value == NULL) { - goto fail; - } + if (value == NULL) + { + goto fail; + } - buffer.content = (const unsigned char *) value; - buffer.length = strlen((const char *) value) + sizeof(""); - buffer.offset = 0; - buffer.hooks = global_hooks; + buffer.content = (const unsigned char*)value; + buffer.length = strlen((const char*)value) + sizeof(""); + buffer.offset = 0; + buffer.hooks = global_hooks; - item = cJSON_New_Item(&global_hooks); - if(item == NULL) { /* memory fail */ - goto fail; - } + item = cJSON_New_Item(&global_hooks); + if (item == NULL) /* memory fail */ + { + goto fail; + } - if(!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer)))) { - /* parse failure. ep is set. */ - goto fail; - } + if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer)))) + { + /* parse failure. ep is set. */ + goto fail; + } - /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */ - if(require_null_terminated) { - buffer_skip_whitespace(&buffer); - if((buffer.offset >= buffer.length) || - (buffer_at_offset(&buffer)[0] != '\0') ) - { - goto fail; - } - } - if(return_parse_end) { - *return_parse_end = (const char *) buffer_at_offset(&buffer); - } + /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */ + if (require_null_terminated) + { + buffer_skip_whitespace(&buffer); + if ((buffer.offset >= buffer.length) || buffer_at_offset(&buffer)[0] != '\0') + { + goto fail; + } + } + if (return_parse_end) + { + *return_parse_end = (const char*)buffer_at_offset(&buffer); + } - return item; + return item; fail: - if(item != NULL) { - cJSON_Delete(item); - } + if (item != NULL) + { + cJSON_Delete(item); + } - if(value != NULL) { - error local_error; - local_error.json = (const unsigned char *) value; - local_error.position = 0; + if (value != NULL) + { + error local_error; + local_error.json = (const unsigned char*)value; + local_error.position = 0; - if(buffer.offset < buffer.length) { - local_error.position = buffer.offset; - } else if(buffer.length > 0) { - local_error.position = buffer.length - 1; - } + if (buffer.offset < buffer.length) + { + local_error.position = buffer.offset; + } + else if (buffer.length > 0) + { + local_error.position = buffer.length - 1; + } - if(return_parse_end != NULL) { - *return_parse_end = (const char *) local_error.json + - local_error.position; - } + if (return_parse_end != NULL) + { + *return_parse_end = (const char*)local_error.json + local_error.position; + } - global_error = local_error; - } + global_error = local_error; + } - return NULL; + return NULL; } /* Default options for cJSON_Parse */ CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value) { - return cJSON_ParseWithOpts(value, 0, 0); + return cJSON_ParseWithOpts(value, 0, 0); } #define cjson_min(a, b) ((a < b) ? a : b) -static unsigned char *print(const cJSON *const item, cJSON_bool format, - const internal_hooks *const hooks) { - static const size_t default_buffer_size = 256; - printbuffer buffer[1]; - unsigned char *printed = NULL; +static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks) +{ + static const size_t default_buffer_size = 256; + printbuffer buffer[1]; + unsigned char *printed = NULL; - memset(buffer, 0, sizeof(buffer)); + memset(buffer, 0, sizeof(buffer)); - /* create buffer */ - buffer->buffer = (unsigned char *) hooks->allocate(default_buffer_size); - buffer->length = default_buffer_size; - buffer->format = format; - buffer->hooks = *hooks; - if(buffer->buffer == NULL) { - goto fail; - } + /* create buffer */ + buffer->buffer = (unsigned char*) hooks->allocate(default_buffer_size); + buffer->length = default_buffer_size; + buffer->format = format; + buffer->hooks = *hooks; + if (buffer->buffer == NULL) + { + goto fail; + } - /* print the value */ - if(!print_value(item, buffer)) { - goto fail; - } - update_offset(buffer); + /* print the value */ + if (!print_value(item, buffer)) + { + goto fail; + } + update_offset(buffer); - /* check if reallocate is available */ - if(hooks->reallocate != NULL) { - printed = (unsigned char *) hooks->reallocate(buffer->buffer, - buffer->offset + - 1); - if(printed == NULL) { - goto fail; - } - buffer->buffer = NULL; - } else { /* otherwise copy the JSON over to a new buffer */ - printed = (unsigned char *) hooks->allocate(buffer->offset + 1); - if(printed == NULL) { - goto fail; - } - memcpy(printed, buffer->buffer, - cjson_min(buffer->length, buffer->offset + 1)); - printed[buffer->offset] = '\0'; /* just to be sure */ + /* check if reallocate is available */ + if (hooks->reallocate != NULL) + { + printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1); + if (printed == NULL) { + goto fail; + } + buffer->buffer = NULL; + } + else /* otherwise copy the JSON over to a new buffer */ + { + printed = (unsigned char*) hooks->allocate(buffer->offset + 1); + if (printed == NULL) + { + goto fail; + } + memcpy(printed, buffer->buffer, cjson_min(buffer->length, buffer->offset + 1)); + printed[buffer->offset] = '\0'; /* just to be sure */ - /* free the buffer */ - hooks->deallocate(buffer->buffer); - } + /* free the buffer */ + hooks->deallocate(buffer->buffer); + } - return printed; + return printed; fail: - if(buffer->buffer != NULL) { - hooks->deallocate(buffer->buffer); - } + if (buffer->buffer != NULL) + { + hooks->deallocate(buffer->buffer); + } - if(printed != NULL) { - hooks->deallocate(printed); - } + if (printed != NULL) + { + hooks->deallocate(printed); + } - return NULL; + return NULL; } /* Render a cJSON item/entity/structure to text. */ -CJSON_PUBLIC(char *) cJSON_Print(const cJSON * item) +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item) { - return (char *) print(item, true, &global_hooks); + return (char*)print(item, true, &global_hooks); } -CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON * item) +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item) { - return (char *) print(item, false, &global_hooks); + return (char*)print(item, false, &global_hooks); } -CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON * item, int prebuffer, - cJSON_bool fmt) +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) { - printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; - if(prebuffer < 0) { - return NULL; - } + if (prebuffer < 0) + { + return NULL; + } - p.buffer = (unsigned char *) global_hooks.allocate((size_t) prebuffer); - if(!p.buffer) { - return NULL; - } + p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer); + if (!p.buffer) + { + return NULL; + } - p.length = (size_t) prebuffer; - p.offset = 0; - p.noalloc = false; - p.format = fmt; - p.hooks = global_hooks; + p.length = (size_t)prebuffer; + p.offset = 0; + p.noalloc = false; + p.format = fmt; + p.hooks = global_hooks; - if(!print_value(item, &p)) { - global_hooks.deallocate(p.buffer); - return NULL; - } + if (!print_value(item, &p)) + { + global_hooks.deallocate(p.buffer); + return NULL; + } - return (char *) p.buffer; + return (char*)p.buffer; } -CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON * item, char *buf, - const int len, - const cJSON_bool fmt) +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON_bool fmt) { - printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; - if((len < 0) || - (buf == NULL)) - { - return false; - } + if ((len < 0) || (buf == NULL)) + { + return false; + } - p.buffer = (unsigned char *) buf; - p.length = (size_t) len; - p.offset = 0; - p.noalloc = true; - p.format = fmt; - p.hooks = global_hooks; + p.buffer = (unsigned char*)buf; + p.length = (size_t)len; + p.offset = 0; + p.noalloc = true; + p.format = fmt; + p.hooks = global_hooks; - return print_value(item, &p); + return print_value(item, &p); } /* Parser core - when encountering text, process appropriately. */ -static cJSON_bool parse_value(cJSON *const item, - parse_buffer *const input_buffer) { - if((input_buffer == NULL) || - (input_buffer->content == NULL)) - { - return false; /* no input */ - } +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer) +{ + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; /* no input */ + } - /* parse the different types of values */ - /* null */ - if(can_read(input_buffer, 4) && - (strncmp((const char *) buffer_at_offset(input_buffer), "null", - 4) == 0)) - { - item->type = cJSON_NULL; - input_buffer->offset += 4; - return true; - } - /* false */ - if(can_read(input_buffer, 5) && - (strncmp((const char *) buffer_at_offset(input_buffer), "false", - 5) == 0)) - { - item->type = cJSON_False; - input_buffer->offset += 5; - return true; - } - /* true */ - if(can_read(input_buffer, 4) && - (strncmp((const char *) buffer_at_offset(input_buffer), "true", - 4) == 0)) - { - item->type = cJSON_True; - item->valueint = 1; - input_buffer->offset += 4; - return true; - } - /* string */ - if(can_access_at_index(input_buffer, 0) && - (buffer_at_offset(input_buffer)[0] == '\"')) - { - return parse_string(item, input_buffer); - } - /* number */ - if(can_access_at_index(input_buffer, 0) && - ((buffer_at_offset(input_buffer)[0] == '-') || - ((buffer_at_offset(input_buffer)[0] >= '0') && - (buffer_at_offset(input_buffer)[0] <= '9')))) - { - return parse_number(item, input_buffer); - } - /* array */ - if(can_access_at_index(input_buffer, 0) && - (buffer_at_offset(input_buffer)[0] == '[')) - { - return parse_array(item, input_buffer); - } - /* object */ - if(can_access_at_index(input_buffer, 0) && - (buffer_at_offset(input_buffer)[0] == '{')) - { - return parse_object(item, input_buffer); - } + /* parse the different types of values */ + /* null */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0)) + { + item->type = cJSON_NULL; + input_buffer->offset += 4; + return true; + } + /* false */ + if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0)) + { + item->type = cJSON_False; + input_buffer->offset += 5; + return true; + } + /* true */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0)) + { + item->type = cJSON_True; + item->valueint = 1; + input_buffer->offset += 4; + return true; + } + /* string */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '\"')) + { + return parse_string(item, input_buffer); + } + /* number */ + if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9')))) + { + return parse_number(item, input_buffer); + } + /* array */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '[')) + { + return parse_array(item, input_buffer); + } + /* object */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{')) + { + return parse_object(item, input_buffer); + } - return false; + return false; } /* Render a value to text. */ -static cJSON_bool print_value(const cJSON *const item, - printbuffer *const output_buffer) { - unsigned char *output = NULL; +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output = NULL; - if((item == NULL) || - (output_buffer == NULL)) - { - return false; - } + if ((item == NULL) || (output_buffer == NULL)) + { + return false; + } - switch((item->type) & 0xFF) { - case cJSON_NULL: - output = ensure(output_buffer, 5); - if(output == NULL) { - return false; - } - strcpy((char *) output, "null"); - return true; + switch ((item->type) & 0xFF) + { + case cJSON_NULL: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "null"); + return true; - case cJSON_False: - output = ensure(output_buffer, 6); - if(output == NULL) { - return false; - } - strcpy((char *) output, "false"); - return true; + case cJSON_False: + output = ensure(output_buffer, 6); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "false"); + return true; - case cJSON_True: - output = ensure(output_buffer, 5); - if(output == NULL) { - return false; - } - strcpy((char *) output, "true"); - return true; + case cJSON_True: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "true"); + return true; - case cJSON_Number: - return print_number(item, output_buffer); + case cJSON_Number: + return print_number(item, output_buffer); - case cJSON_Raw: - { - size_t raw_length = 0; - if(item->valuestring == NULL) { - return false; - } + case cJSON_Raw: + { + size_t raw_length = 0; + if (item->valuestring == NULL) + { + return false; + } - raw_length = strlen(item->valuestring) + sizeof(""); - output = ensure(output_buffer, raw_length); - if(output == NULL) { - return false; - } - memcpy(output, item->valuestring, raw_length); - return true; - } + raw_length = strlen(item->valuestring) + sizeof(""); + output = ensure(output_buffer, raw_length); + if (output == NULL) + { + return false; + } + memcpy(output, item->valuestring, raw_length); + return true; + } - case cJSON_String: - return print_string(item, output_buffer); + case cJSON_String: + return print_string(item, output_buffer); - case cJSON_Array: - return print_array(item, output_buffer); + case cJSON_Array: + return print_array(item, output_buffer); - case cJSON_Object: - return print_object(item, output_buffer); + case cJSON_Object: + return print_object(item, output_buffer); - default: - return false; - } + default: + return false; + } } /* Build an array from input text. */ -static cJSON_bool parse_array(cJSON *const item, - parse_buffer *const input_buffer) { - cJSON *head = NULL; /* head of the linked list */ - cJSON *current_item = NULL; +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* head of the linked list */ + cJSON *current_item = NULL; - if(input_buffer->depth >= CJSON_NESTING_LIMIT) { - return false; /* to deeply nested */ - } - input_buffer->depth++; + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; - if(buffer_at_offset(input_buffer)[0] != '[') { - /* not an array */ - goto fail; - } + if (buffer_at_offset(input_buffer)[0] != '[') + { + /* not an array */ + goto fail; + } - input_buffer->offset++; - buffer_skip_whitespace(input_buffer); - if(can_access_at_index(input_buffer, 0) && - (buffer_at_offset(input_buffer)[0] == ']')) - { - /* empty array */ - goto success; - } + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']')) + { + /* empty array */ + goto success; + } - /* check if we skipped to the end of the buffer */ - if(cannot_access_at_index(input_buffer, 0)) { - input_buffer->offset--; - goto fail; - } + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } - /* step back to character in front of the first element */ - input_buffer->offset--; - /* loop through the comma separated array elements */ - do { - /* allocate next item */ - cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); - if(new_item == NULL) { - goto fail; /* allocation failure */ - } + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } - /* attach next item to list */ - if(head == NULL) { - /* start the linked list */ - current_item = head = new_item; - } else { - /* add to the end and advance */ - current_item->next = new_item; - new_item->prev = current_item; - current_item = new_item; - } + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } - /* parse next value */ - input_buffer->offset++; - buffer_skip_whitespace(input_buffer); - if(!parse_value(current_item, input_buffer)) { - goto fail; /* failed to parse value */ - } - buffer_skip_whitespace(input_buffer); - } while(can_access_at_index(input_buffer, 0) && - (buffer_at_offset(input_buffer)[0] == ',')); + /* parse next value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); - if(cannot_access_at_index(input_buffer, 0) || - (buffer_at_offset(input_buffer)[0] != ']') ) - { - goto fail; /* expected end of array */ - } + if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']') + { + goto fail; /* expected end of array */ + } success: - input_buffer->depth--; + input_buffer->depth--; - item->type = cJSON_Array; - item->child = head; + item->type = cJSON_Array; + item->child = head; - input_buffer->offset++; + input_buffer->offset++; - return true; + return true; fail: - if(head != NULL) { - cJSON_Delete(head); - } + if (head != NULL) + { + cJSON_Delete(head); + } - return false; + return false; } /* Render an array to text */ -static cJSON_bool print_array(const cJSON *const item, - printbuffer *const output_buffer) { - unsigned char *output_pointer = NULL; - size_t length = 0; - cJSON *current_element = item->child; +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_element = item->child; - if(output_buffer == NULL) { - return false; - } + if (output_buffer == NULL) + { + return false; + } - /* Compose the output array. */ - /* opening square bracket */ - output_pointer = ensure(output_buffer, 1); - if(output_pointer == NULL) { - return false; - } + /* Compose the output array. */ + /* opening square bracket */ + output_pointer = ensure(output_buffer, 1); + if (output_pointer == NULL) + { + return false; + } - *output_pointer = '['; - output_buffer->offset++; - output_buffer->depth++; + *output_pointer = '['; + output_buffer->offset++; + output_buffer->depth++; - while(current_element != NULL) { - if(!print_value(current_element, output_buffer)) { - return false; - } - update_offset(output_buffer); - if(current_element->next) { - length = (size_t) (output_buffer->format ? 2 : 1); - output_pointer = ensure(output_buffer, length + 1); - if(output_pointer == NULL) { - return false; - } - *output_pointer++ = ','; - if(output_buffer->format) { - *output_pointer++ = ' '; - } - *output_pointer = '\0'; - output_buffer->offset += length; - } - current_element = current_element->next; - } + while (current_element != NULL) + { + if (!print_value(current_element, output_buffer)) + { + return false; + } + update_offset(output_buffer); + if (current_element->next) + { + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ','; + if(output_buffer->format) + { + *output_pointer++ = ' '; + } + *output_pointer = '\0'; + output_buffer->offset += length; + } + current_element = current_element->next; + } - output_pointer = ensure(output_buffer, 2); - if(output_pointer == NULL) { - return false; - } - *output_pointer++ = ']'; - *output_pointer = '\0'; - output_buffer->depth--; + output_pointer = ensure(output_buffer, 2); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ']'; + *output_pointer = '\0'; + output_buffer->depth--; - return true; + return true; } /* Build an object from the text. */ -static cJSON_bool parse_object(cJSON *const item, - parse_buffer *const input_buffer) { - cJSON *head = NULL; /* linked list head */ - cJSON *current_item = NULL; +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* linked list head */ + cJSON *current_item = NULL; - if(input_buffer->depth >= CJSON_NESTING_LIMIT) { - return false; /* to deeply nested */ - } - input_buffer->depth++; + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; - if(cannot_access_at_index(input_buffer, 0) || - (buffer_at_offset(input_buffer)[0] != '{')) - { - goto fail; /* not an object */ - } + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{')) + { + goto fail; /* not an object */ + } - input_buffer->offset++; - buffer_skip_whitespace(input_buffer); - if(can_access_at_index(input_buffer, 0) && - (buffer_at_offset(input_buffer)[0] == '}')) - { - goto success; /* empty object */ - } + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}')) + { + goto success; /* empty object */ + } - /* check if we skipped to the end of the buffer */ - if(cannot_access_at_index(input_buffer, 0)) { - input_buffer->offset--; - goto fail; - } + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } - /* step back to character in front of the first element */ - input_buffer->offset--; - /* loop through the comma separated array elements */ - do { - /* allocate next item */ - cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); - if(new_item == NULL) { - goto fail; /* allocation failure */ - } + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } - /* attach next item to list */ - if(head == NULL) { - /* start the linked list */ - current_item = head = new_item; - } else { - /* add to the end and advance */ - current_item->next = new_item; - new_item->prev = current_item; - current_item = new_item; - } + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } - /* parse the name of the child */ - input_buffer->offset++; - buffer_skip_whitespace(input_buffer); - if(!parse_string(current_item, input_buffer)) { - goto fail; /* faile to parse name */ - } - buffer_skip_whitespace(input_buffer); + /* parse the name of the child */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_string(current_item, input_buffer)) + { + goto fail; /* faile to parse name */ + } + buffer_skip_whitespace(input_buffer); - /* swap valuestring and string, because we parsed the name */ - current_item->string = current_item->valuestring; - current_item->valuestring = NULL; + /* swap valuestring and string, because we parsed the name */ + current_item->string = current_item->valuestring; + current_item->valuestring = NULL; - if(cannot_access_at_index(input_buffer, 0) || - (buffer_at_offset(input_buffer)[0] != ':')) - { - goto fail; /* invalid object */ - } + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':')) + { + goto fail; /* invalid object */ + } - /* parse the value */ - input_buffer->offset++; - buffer_skip_whitespace(input_buffer); - if(!parse_value(current_item, input_buffer)) { - goto fail; /* failed to parse value */ - } - buffer_skip_whitespace(input_buffer); - } while(can_access_at_index(input_buffer, 0) && - (buffer_at_offset(input_buffer)[0] == ',')); + /* parse the value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); - if(cannot_access_at_index(input_buffer, 0) || - (buffer_at_offset(input_buffer)[0] != '}')) - { - goto fail; /* expected end of object */ - } + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}')) + { + goto fail; /* expected end of object */ + } success: - input_buffer->depth--; + input_buffer->depth--; - item->type = cJSON_Object; - item->child = head; + item->type = cJSON_Object; + item->child = head; - input_buffer->offset++; - return true; + input_buffer->offset++; + return true; fail: - if(head != NULL) { - cJSON_Delete(head); - } + if (head != NULL) + { + cJSON_Delete(head); + } - return false; + return false; } /* Render an object to text. */ -static cJSON_bool print_object(const cJSON *const item, - printbuffer *const output_buffer) { - unsigned char *output_pointer = NULL; - size_t length = 0; - cJSON *current_item = item->child; +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_item = item->child; - if(output_buffer == NULL) { - return false; - } + if (output_buffer == NULL) + { + return false; + } - /* Compose the output: */ - length = (size_t) (output_buffer->format ? 2 : 1); /* fmt: {\n */ - output_pointer = ensure(output_buffer, length + 1); - if(output_pointer == NULL) { - return false; - } + /* Compose the output: */ + length = (size_t) (output_buffer->format ? 2 : 1); /* fmt: {\n */ + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } - *output_pointer++ = '{'; - output_buffer->depth++; - if(output_buffer->format) { - *output_pointer++ = '\n'; - } - output_buffer->offset += length; + *output_pointer++ = '{'; + output_buffer->depth++; + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + output_buffer->offset += length; - while(current_item) { - if(output_buffer->format) { - size_t i; - output_pointer = ensure(output_buffer, - output_buffer->depth); - if(output_pointer == NULL) { - return false; - } - for(i = 0; i < output_buffer->depth; i++) { - *output_pointer++ = '\t'; - } - output_buffer->offset += output_buffer->depth; - } + while (current_item) + { + if (output_buffer->format) + { + size_t i; + output_pointer = ensure(output_buffer, output_buffer->depth); + if (output_pointer == NULL) + { + return false; + } + for (i = 0; i < output_buffer->depth; i++) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += output_buffer->depth; + } - /* print key */ - if(!print_string_ptr((unsigned char *) current_item->string, - output_buffer)) { - return false; - } - update_offset(output_buffer); + /* print key */ + if (!print_string_ptr((unsigned char*)current_item->string, output_buffer)) + { + return false; + } + update_offset(output_buffer); - length = (size_t) (output_buffer->format ? 2 : 1); - output_pointer = ensure(output_buffer, length); - if(output_pointer == NULL) { - return false; - } - *output_pointer++ = ':'; - if(output_buffer->format) { - *output_pointer++ = '\t'; - } - output_buffer->offset += length; + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ':'; + if (output_buffer->format) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += length; - /* print value */ - if(!print_value(current_item, output_buffer)) { - return false; - } - update_offset(output_buffer); + /* print value */ + if (!print_value(current_item, output_buffer)) + { + return false; + } + update_offset(output_buffer); - /* print comma if not last */ - length = - (size_t) ((output_buffer->format ? 1 : 0) + - (current_item->next ? 1 : 0)); - output_pointer = ensure(output_buffer, length + 1); - if(output_pointer == NULL) { - return false; - } - if(current_item->next) { - *output_pointer++ = ','; - } + /* print comma if not last */ + length = (size_t) ((output_buffer->format ? 1 : 0) + (current_item->next ? 1 : 0)); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + if (current_item->next) + { + *output_pointer++ = ','; + } - if(output_buffer->format) { - *output_pointer++ = '\n'; - } - *output_pointer = '\0'; - output_buffer->offset += length; + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + *output_pointer = '\0'; + output_buffer->offset += length; - current_item = current_item->next; - } + current_item = current_item->next; + } - output_pointer = - ensure(output_buffer, - output_buffer->format ? (output_buffer->depth + 1) : 2); - if(output_pointer == NULL) { - return false; - } - if(output_buffer->format) { - size_t i; - for(i = 0; i < (output_buffer->depth - 1); i++) { - *output_pointer++ = '\t'; - } - } - *output_pointer++ = '}'; - *output_pointer = '\0'; - output_buffer->depth--; + output_pointer = ensure(output_buffer, output_buffer->format ? (output_buffer->depth + 1) : 2); + if (output_pointer == NULL) + { + return false; + } + if (output_buffer->format) + { + size_t i; + for (i = 0; i < (output_buffer->depth - 1); i++) + { + *output_pointer++ = '\t'; + } + } + *output_pointer++ = '}'; + *output_pointer = '\0'; + output_buffer->depth--; - return true; + return true; } /* Get Array size/item / object item. */ -CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON * array) +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array) { - cJSON *child = NULL; - size_t size = 0; + cJSON *child = NULL; + size_t size = 0; - if(array == NULL) { - return 0; - } + if (array == NULL) + { + return 0; + } - child = array->child; + child = array->child; - while(child != NULL) { - size++; - child = child->next; - } + while(child != NULL) + { + size++; + child = child->next; + } - /* FIXME: Can overflow here. Cannot be fixed without breaking the API */ + /* FIXME: Can overflow here. Cannot be fixed without breaking the API */ - return (int) size; + return (int)size; } -static cJSON *get_array_item(const cJSON *array, size_t index) { - cJSON *current_child = NULL; - - if(array == NULL) { - return NULL; - } - - current_child = array->child; - while((current_child != NULL) && - (index > 0)) - { - index--; - current_child = current_child->next; - } - - return current_child; -} - -CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON * array, int index) +static cJSON* get_array_item(const cJSON *array, size_t index) { - if(index < 0) { - return NULL; - } + cJSON *current_child = NULL; - return get_array_item(array, (size_t) index); + if (array == NULL) + { + return NULL; + } + + current_child = array->child; + while ((current_child != NULL) && (index > 0)) + { + index--; + current_child = current_child->next; + } + + return current_child; } -static cJSON *get_object_item(const cJSON *const object, const char *const name, - const cJSON_bool case_sensitive) { - cJSON *current_element = NULL; - - if((object == NULL) || - (name == NULL)) - { - return NULL; - } - - current_element = object->child; - if(case_sensitive) { - while((current_element != NULL) && - (strcmp(name, current_element->string) != 0)) - { - current_element = current_element->next; - } - } else { - while((current_element != NULL) && - (case_insensitive_strcmp((const unsigned char *) name, - (const unsigned char *) ( - current_element->string)) - != 0)) - { - current_element = current_element->next; - } - } - - return current_element; -} - -CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, - const char *const string) +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index) { - return get_object_item(object, string, false); + if (index < 0) + { + return NULL; + } + + return get_array_item(array, (size_t)index); } -CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive( - const cJSON * const object, const char *const string) +static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) { - return get_object_item(object, string, true); + cJSON *current_element = NULL; + + if ((object == NULL) || (name == NULL)) + { + return NULL; + } + + current_element = object->child; + if (case_sensitive) + { + while ((current_element != NULL) && (strcmp(name, current_element->string) != 0)) + { + current_element = current_element->next; + } + } + else + { + while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0)) + { + current_element = current_element->next; + } + } + + return current_element; } -CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON * object, - const char *string) +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) { - return cJSON_GetObjectItem(object, string) ? 1 : 0; + return get_object_item(object, string, false); +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, true); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string) +{ + return cJSON_GetObjectItem(object, string) ? 1 : 0; } /* Utility for array list handling. */ -static void suffix_object(cJSON *prev, cJSON *item) { - prev->next = item; - item->prev = prev; +static void suffix_object(cJSON *prev, cJSON *item) +{ + prev->next = item; + item->prev = prev; } /* Utility for handling references. */ -static cJSON *create_reference(const cJSON *item, - const internal_hooks *const hooks) { - cJSON *reference = NULL; - if(item == NULL) { - return NULL; - } +static cJSON *create_reference(const cJSON *item, const internal_hooks * const hooks) +{ + cJSON *reference = NULL; + if (item == NULL) + { + return NULL; + } - reference = cJSON_New_Item(hooks); - if(reference == NULL) { - return NULL; - } + reference = cJSON_New_Item(hooks); + if (reference == NULL) + { + return NULL; + } - memcpy(reference, item, sizeof(cJSON)); - reference->string = NULL; - reference->type |= cJSON_IsReference; - reference->next = reference->prev = NULL; - return reference; + memcpy(reference, item, sizeof(cJSON)); + reference->string = NULL; + reference->type |= cJSON_IsReference; + reference->next = reference->prev = NULL; + return reference; } -static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) { - cJSON *child = NULL; +static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) +{ + cJSON *child = NULL; - if((item == NULL) || - (array == NULL)) - { - return false; - } + if ((item == NULL) || (array == NULL)) + { + return false; + } - child = array->child; + child = array->child; - if(child == NULL) { - /* list is empty, start new one */ - array->child = item; - } else { - /* append to the end */ - while(child->next) { - child = child->next; - } - suffix_object(child, item); - } + if (child == NULL) + { + /* list is empty, start new one */ + array->child = item; + } + else + { + /* append to the end */ + while (child->next) + { + child = child->next; + } + suffix_object(child, item); + } - return true; + return true; } /* Add item to array/object. */ -CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON * array, cJSON * item) +CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item) { - add_item_to_array(array, item); + add_item_to_array(array, item); } -#if defined(__clang__) || \ - (defined(__GNUC__) && \ - ((__GNUC__ > 4) || \ - ((__GNUC__ == 4) && \ - (__GNUC_MINOR__ > 5)))) +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) #pragma GCC diagnostic push #endif #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wcast-qual" #endif /* helper function to cast away const */ -static void *cast_away_const(const void *string) { - return (void *) string; +static void* cast_away_const(const void* string) +{ + return (void*)string; } -#if defined(__clang__) || \ - (defined(__GNUC__) && \ - ((__GNUC__ > 4) || \ - ((__GNUC__ == 4) && \ - (__GNUC_MINOR__ > 5)))) +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) #pragma GCC diagnostic pop #endif -static cJSON_bool add_item_to_object(cJSON *const object, - const char *const string, - cJSON *const item, - const internal_hooks *const hooks, - const cJSON_bool constant_key) +static cJSON_bool add_item_to_object(cJSON * const object, const char * const string, cJSON * const item, const internal_hooks * const hooks, const cJSON_bool constant_key) { - char *new_key = NULL; - int new_type = cJSON_Invalid; + char *new_key = NULL; + int new_type = cJSON_Invalid; - if((object == NULL) || - (string == NULL) || - (item == NULL)) - { - return false; - } + if ((object == NULL) || (string == NULL) || (item == NULL)) + { + return false; + } - if(constant_key) { - new_key = (char *) cast_away_const(string); - new_type = item->type | cJSON_StringIsConst; - } else { - new_key = (char *) cJSON_strdup((const unsigned char *) string, - hooks); - if(new_key == NULL) { - return false; - } + if (constant_key) + { + new_key = (char*)cast_away_const(string); + new_type = item->type | cJSON_StringIsConst; + } + else + { + new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks); + if (new_key == NULL) + { + return false; + } - new_type = item->type & ~cJSON_StringIsConst; - } + new_type = item->type & ~cJSON_StringIsConst; + } - if(!(item->type & cJSON_StringIsConst) && - (item->string != NULL)) - { - hooks->deallocate(item->string); - } + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + hooks->deallocate(item->string); + } - item->string = new_key; - item->type = new_type; + item->string = new_key; + item->type = new_type; - return add_item_to_array(object, item); + return add_item_to_array(object, item); } -CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON * object, const char *string, - cJSON * item) +CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) { - add_item_to_object(object, string, item, &global_hooks, false); + add_item_to_object(object, string, item, &global_hooks, false); } /* Add an item to an object with constant string as key */ -CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON * object, const char *string, - cJSON * item) +CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) { - add_item_to_object(object, string, item, &global_hooks, true); + add_item_to_object(object, string, item, &global_hooks, true); } -CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON * array, cJSON * item) +CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) { - if(array == NULL) { - return; - } + if (array == NULL) + { + return; + } - add_item_to_array(array, create_reference(item, &global_hooks)); + add_item_to_array(array, create_reference(item, &global_hooks)); } -CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON * object, - const char *string, - cJSON * item) +CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) { - if((object == NULL) || - (string == NULL)) - { - return; - } + if ((object == NULL) || (string == NULL)) + { + return; + } - add_item_to_object(object, string, create_reference(item, - &global_hooks), &global_hooks, - false); + add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); } -CJSON_PUBLIC(cJSON *) cJSON_AddNullToObject(cJSON * const object, - const char *const name) +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name) { - cJSON *null = cJSON_CreateNull(); - if(add_item_to_object(object, name, null, &global_hooks, false)) { - return null; - } + cJSON *null = cJSON_CreateNull(); + if (add_item_to_object(object, name, null, &global_hooks, false)) + { + return null; + } - cJSON_Delete(null); - return NULL; + cJSON_Delete(null); + return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_AddTrueToObject(cJSON * const object, - const char *const name) +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name) { - cJSON *true_item = cJSON_CreateTrue(); - if(add_item_to_object(object, name, true_item, &global_hooks, false)) { - return true_item; - } + cJSON *true_item = cJSON_CreateTrue(); + if (add_item_to_object(object, name, true_item, &global_hooks, false)) + { + return true_item; + } - cJSON_Delete(true_item); - return NULL; + cJSON_Delete(true_item); + return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_AddFalseToObject(cJSON * const object, - const char *const name) +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name) { - cJSON *false_item = cJSON_CreateFalse(); - if(add_item_to_object(object, name, false_item, &global_hooks, false)) { - return false_item; - } + cJSON *false_item = cJSON_CreateFalse(); + if (add_item_to_object(object, name, false_item, &global_hooks, false)) + { + return false_item; + } - cJSON_Delete(false_item); - return NULL; + cJSON_Delete(false_item); + return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_AddBoolToObject(cJSON * const object, - const char *const name, - const cJSON_bool boolean) +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean) { - cJSON *bool_item = cJSON_CreateBool(boolean); - if(add_item_to_object(object, name, bool_item, &global_hooks, false)) { - return bool_item; - } + cJSON *bool_item = cJSON_CreateBool(boolean); + if (add_item_to_object(object, name, bool_item, &global_hooks, false)) + { + return bool_item; + } - cJSON_Delete(bool_item); - return NULL; + cJSON_Delete(bool_item); + return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_AddNumberToObject(cJSON * const object, - const char *const name, - const double number) +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number) { - cJSON *number_item = cJSON_CreateNumber(number); - if(add_item_to_object(object, name, number_item, &global_hooks, - false)) { - return number_item; - } + cJSON *number_item = cJSON_CreateNumber(number); + if (add_item_to_object(object, name, number_item, &global_hooks, false)) + { + return number_item; + } - cJSON_Delete(number_item); - return NULL; + cJSON_Delete(number_item); + return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_AddStringToObject(cJSON * const object, - const char *const name, - const char *const string) +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string) { - cJSON *string_item = cJSON_CreateString(string); - if(add_item_to_object(object, name, string_item, &global_hooks, - false)) { - return string_item; - } + cJSON *string_item = cJSON_CreateString(string); + if (add_item_to_object(object, name, string_item, &global_hooks, false)) + { + return string_item; + } - cJSON_Delete(string_item); - return NULL; + cJSON_Delete(string_item); + return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_AddRawToObject(cJSON * const object, - const char *const name, - const char *const raw) +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw) { - cJSON *raw_item = cJSON_CreateRaw(raw); - if(add_item_to_object(object, name, raw_item, &global_hooks, false)) { - return raw_item; - } + cJSON *raw_item = cJSON_CreateRaw(raw); + if (add_item_to_object(object, name, raw_item, &global_hooks, false)) + { + return raw_item; + } - cJSON_Delete(raw_item); - return NULL; + cJSON_Delete(raw_item); + return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_AddObjectToObject(cJSON * const object, - const char *const name) +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name) { - cJSON *object_item = cJSON_CreateObject(); - if(add_item_to_object(object, name, object_item, &global_hooks, - false)) { - return object_item; - } + cJSON *object_item = cJSON_CreateObject(); + if (add_item_to_object(object, name, object_item, &global_hooks, false)) + { + return object_item; + } - cJSON_Delete(object_item); - return NULL; + cJSON_Delete(object_item); + return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_AddArrayToObject(cJSON * const object, - const char *const name) +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name) { - cJSON *array = cJSON_CreateArray(); - if(add_item_to_object(object, name, array, &global_hooks, false)) { - return array; - } + cJSON *array = cJSON_CreateArray(); + if (add_item_to_object(object, name, array, &global_hooks, false)) + { + return array; + } - cJSON_Delete(array); - return NULL; + cJSON_Delete(array); + return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON * parent, - cJSON * const item) +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) { - if((parent == NULL) || - (item == NULL)) - { - return NULL; - } + if ((parent == NULL) || (item == NULL)) + { + return NULL; + } - if(item->prev != NULL) { - /* not the first element */ - item->prev->next = item->next; - } - if(item->next != NULL) { - /* not the last element */ - item->next->prev = item->prev; - } + if (item->prev != NULL) + { + /* not the first element */ + item->prev->next = item->next; + } + if (item->next != NULL) + { + /* not the last element */ + item->next->prev = item->prev; + } - if(item == parent->child) { - /* first element */ - parent->child = item->next; - } - /* make sure the detached item doesn't point anywhere anymore */ - item->prev = NULL; - item->next = NULL; + if (item == parent->child) + { + /* first element */ + parent->child = item->next; + } + /* make sure the detached item doesn't point anywhere anymore */ + item->prev = NULL; + item->next = NULL; - return item; + return item; } -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON * array, int which) +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which) { - if(which < 0) { - return NULL; - } + if (which < 0) + { + return NULL; + } - return cJSON_DetachItemViaPointer(array, - get_array_item(array, - (size_t) which)); + return cJSON_DetachItemViaPointer(array, get_array_item(array, (size_t)which)); } -CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON * array, int which) +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which) { - cJSON_Delete(cJSON_DetachItemFromArray(array, which)); + cJSON_Delete(cJSON_DetachItemFromArray(array, which)); } -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON * object, - const char *string) +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string) { - cJSON *to_detach = cJSON_GetObjectItem(object, string); + cJSON *to_detach = cJSON_GetObjectItem(object, string); - return cJSON_DetachItemViaPointer(object, to_detach); + return cJSON_DetachItemViaPointer(object, to_detach); } -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON * object, - const char *string) +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string) { - cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(object, string); + cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(object, string); - return cJSON_DetachItemViaPointer(object, to_detach); + return cJSON_DetachItemViaPointer(object, to_detach); } -CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON * object, - const char *string) +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string) { - cJSON_Delete(cJSON_DetachItemFromObject(object, string)); + cJSON_Delete(cJSON_DetachItemFromObject(object, string)); } -CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON * object, - const char *string) +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) { - cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string)); + cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string)); } /* Replace array/object items with new ones. */ -CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON * array, int which, - cJSON * newitem) +CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) { - cJSON *after_inserted = NULL; + cJSON *after_inserted = NULL; - if(which < 0) { - return; - } + if (which < 0) + { + return; + } - after_inserted = get_array_item(array, (size_t) which); - if(after_inserted == NULL) { - add_item_to_array(array, newitem); - return; - } + after_inserted = get_array_item(array, (size_t)which); + if (after_inserted == NULL) + { + add_item_to_array(array, newitem); + return; + } - newitem->next = after_inserted; - newitem->prev = after_inserted->prev; - after_inserted->prev = newitem; - if(after_inserted == array->child) { - array->child = newitem; - } else { - newitem->prev->next = newitem; - } + newitem->next = after_inserted; + newitem->prev = after_inserted->prev; + after_inserted->prev = newitem; + if (after_inserted == array->child) + { + array->child = newitem; + } + else + { + newitem->prev->next = newitem; + } } -CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, - cJSON * const item, - cJSON * replacement) +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) { - if((parent == NULL) || - (replacement == NULL) || - (item == NULL)) - { - return false; - } + if ((parent == NULL) || (replacement == NULL) || (item == NULL)) + { + return false; + } - if(replacement == item) { - return true; - } + if (replacement == item) + { + return true; + } - replacement->next = item->next; - replacement->prev = item->prev; + replacement->next = item->next; + replacement->prev = item->prev; - if(replacement->next != NULL) { - replacement->next->prev = replacement; - } - if(replacement->prev != NULL) { - replacement->prev->next = replacement; - } - if(parent->child == item) { - parent->child = replacement; - } + if (replacement->next != NULL) + { + replacement->next->prev = replacement; + } + if (replacement->prev != NULL) + { + replacement->prev->next = replacement; + } + if (parent->child == item) + { + parent->child = replacement; + } - item->next = NULL; - item->prev = NULL; - cJSON_Delete(item); + item->next = NULL; + item->prev = NULL; + cJSON_Delete(item); - return true; + return true; } -CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON * array, int which, - cJSON * newitem) +CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) { - if(which < 0) { - return; - } + if (which < 0) + { + return; + } - cJSON_ReplaceItemViaPointer(array, get_array_item(array, - (size_t) which), - newitem); + cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); } -static cJSON_bool replace_item_in_object(cJSON *object, const char *string, - cJSON *replacement, - cJSON_bool case_sensitive) { - if((replacement == NULL) || - (string == NULL)) - { - return false; - } +static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) +{ + if ((replacement == NULL) || (string == NULL)) + { + return false; + } - /* replace the name in the replacement */ - if(!(replacement->type & cJSON_StringIsConst) && - (replacement->string != NULL)) - { - cJSON_free(replacement->string); - } - replacement->string = (char *) cJSON_strdup( - (const unsigned char *) string, &global_hooks); - replacement->type &= ~cJSON_StringIsConst; + /* replace the name in the replacement */ + if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL)) + { + cJSON_free(replacement->string); + } + replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + replacement->type &= ~cJSON_StringIsConst; - cJSON_ReplaceItemViaPointer(object, - get_object_item(object, string, - case_sensitive), - replacement); + cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); - return true; + return true; } -CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON * object, const char *string, - cJSON * newitem) +CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) { - replace_item_in_object(object, string, newitem, false); + replace_item_in_object(object, string, newitem, false); } -CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON * object, - const char *string, - cJSON * newitem) +CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) { - replace_item_in_object(object, string, newitem, true); + replace_item_in_object(object, string, newitem, true); } /* Create basic types: */ CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item) { - item->type = cJSON_NULL; - } + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_NULL; + } - return item; + return item; } CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item) { - item->type = cJSON_True; - } + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_True; + } - return item; + return item; } CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item) { - item->type = cJSON_False; - } + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_False; + } - return item; + return item; } CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool b) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item) { - item->type = b ? cJSON_True : cJSON_False; - } + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = b ? cJSON_True : cJSON_False; + } - return item; + return item; } CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item) { - item->type = cJSON_Number; - item->valuedouble = num; + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Number; + item->valuedouble = num; - /* use saturation in case of overflow */ - if(num >= INT_MAX) { - item->valueint = INT_MAX; - } else if(num <= INT_MIN) { - item->valueint = INT_MIN; - } else { - item->valueint = (int) num; - } - } + /* use saturation in case of overflow */ + if (num >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (num <= INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)num; + } + } - return item; + return item; } CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item) { - item->type = cJSON_String; - item->valuestring = (char *) cJSON_strdup( - (const unsigned char *) string, &global_hooks); - if(!item->valuestring) { - cJSON_Delete(item); - return NULL; - } - } + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_String; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } - return item; + return item; } CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item != NULL) { - item->type = cJSON_String | cJSON_IsReference; - item->valuestring = (char *) cast_away_const(string); - } + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) + { + item->type = cJSON_String | cJSON_IsReference; + item->valuestring = (char*)cast_away_const(string); + } - return item; + return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON * child) +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item != NULL) { - item->type = cJSON_Object | cJSON_IsReference; - item->child = (cJSON *) cast_away_const(child); - } + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Object | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } - return item; + return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON * child) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item != NULL) { - item->type = cJSON_Array | cJSON_IsReference; - item->child = (cJSON *) cast_away_const(child); - } +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child) { + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Array | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } - return item; + return item; } CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item) { - item->type = cJSON_Raw; - item->valuestring = (char *) cJSON_strdup( - (const unsigned char *) raw, &global_hooks); - if(!item->valuestring) { - cJSON_Delete(item); - return NULL; - } - } + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Raw; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } - return item; + return item; } CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item) { - item->type = cJSON_Array; - } + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type=cJSON_Array; + } - return item; + return item; } CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void) { - cJSON *item = cJSON_New_Item(&global_hooks); - if(item) { - item->type = cJSON_Object; - } + cJSON *item = cJSON_New_Item(&global_hooks); + if (item) + { + item->type = cJSON_Object; + } - return item; + return item; } /* Create Arrays: */ CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count) { - size_t i = 0; - cJSON *n = NULL; - cJSON *p = NULL; - cJSON *a = NULL; + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; - if((count < 0) || - (numbers == NULL)) - { - return NULL; - } + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } - a = cJSON_CreateArray(); - for(i = 0; a && - (i < (size_t) count); i++) - { - n = cJSON_CreateNumber(numbers[i]); - if(!n) { - cJSON_Delete(a); - return NULL; - } - if(!i) { - a->child = n; - } else { - suffix_object(p, n); - } - p = n; - } + a = cJSON_CreateArray(); + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if (!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } - return a; + return a; } CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) { - size_t i = 0; - cJSON *n = NULL; - cJSON *p = NULL; - cJSON *a = NULL; + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; - if((count < 0) || - (numbers == NULL)) - { - return NULL; - } + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } - a = cJSON_CreateArray(); + a = cJSON_CreateArray(); - for(i = 0; a && - (i < (size_t) count); i++) - { - n = cJSON_CreateNumber((double) numbers[i]); - if(!n) { - cJSON_Delete(a); - return NULL; - } - if(!i) { - a->child = n; - } else { - suffix_object(p, n); - } - p = n; - } + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber((double)numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } - return a; + return a; } CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) { - size_t i = 0; - cJSON *n = NULL; - cJSON *p = NULL; - cJSON *a = NULL; + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; - if((count < 0) || - (numbers == NULL)) - { - return NULL; - } + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } - a = cJSON_CreateArray(); + a = cJSON_CreateArray(); - for(i = 0; a && - (i < (size_t) count); i++) - { - n = cJSON_CreateNumber(numbers[i]); - if(!n) { - cJSON_Delete(a); - return NULL; - } - if(!i) { - a->child = n; - } else { - suffix_object(p, n); - } - p = n; - } + for(i = 0;a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } - return a; + return a; } CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count) { - size_t i = 0; - cJSON *n = NULL; - cJSON *p = NULL; - cJSON *a = NULL; + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; - if((count < 0) || - (strings == NULL)) - { - return NULL; - } + if ((count < 0) || (strings == NULL)) + { + return NULL; + } - a = cJSON_CreateArray(); + a = cJSON_CreateArray(); - for(i = 0; a && - (i < (size_t) count); i++) - { - n = cJSON_CreateString(strings[i]); - if(!n) { - cJSON_Delete(a); - return NULL; - } - if(!i) { - a->child = n; - } else { - suffix_object(p, n); - } - p = n; - } + for (i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateString(strings[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p,n); + } + p = n; + } - return a; + return a; } /* Duplication */ -CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON * item, cJSON_bool recurse) +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) { - cJSON *newitem = NULL; - cJSON *child = NULL; - cJSON *next = NULL; - cJSON *newchild = NULL; + cJSON *newitem = NULL; + cJSON *child = NULL; + cJSON *next = NULL; + cJSON *newchild = NULL; - /* Bail on bad ptr */ - if(!item) { - goto fail; - } - /* Create new item */ - newitem = cJSON_New_Item(&global_hooks); - if(!newitem) { - goto fail; - } - /* Copy over all vars */ - newitem->type = item->type & (~cJSON_IsReference); - newitem->valueint = item->valueint; - newitem->valuedouble = item->valuedouble; - if(item->valuestring) { - newitem->valuestring = (char *) cJSON_strdup( - (unsigned char *) item->valuestring, &global_hooks); - if(!newitem->valuestring) { - goto fail; - } - } - if(item->string) { - newitem->string = - (item->type & - cJSON_StringIsConst) ? item->string : (char *) - cJSON_strdup(( - unsigned - char *) item->string, - &global_hooks); - if(!newitem->string) { - goto fail; - } - } - /* If non-recursive, then we're done! */ - if(!recurse) { - return newitem; - } - /* Walk the ->next chain for the child. */ - child = item->child; - while(child != NULL) { - newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ - if(!newchild) { - goto fail; - } - if(next != NULL) { - /* If newitem->child already set, then crosswire ->prev and ->next and move on */ - next->next = newchild; - newchild->prev = next; - next = newchild; - } else { - /* Set newitem->child and move to it */ - newitem->child = newchild; - next = newchild; - } - child = child->next; - } + /* Bail on bad ptr */ + if (!item) + { + goto fail; + } + /* Create new item */ + newitem = cJSON_New_Item(&global_hooks); + if (!newitem) + { + goto fail; + } + /* Copy over all vars */ + newitem->type = item->type & (~cJSON_IsReference); + newitem->valueint = item->valueint; + newitem->valuedouble = item->valuedouble; + if (item->valuestring) + { + newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks); + if (!newitem->valuestring) + { + goto fail; + } + } + if (item->string) + { + newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks); + if (!newitem->string) + { + goto fail; + } + } + /* If non-recursive, then we're done! */ + if (!recurse) + { + return newitem; + } + /* Walk the ->next chain for the child. */ + child = item->child; + while (child != NULL) + { + newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ + if (!newchild) + { + goto fail; + } + if (next != NULL) + { + /* If newitem->child already set, then crosswire ->prev and ->next and move on */ + next->next = newchild; + newchild->prev = next; + next = newchild; + } + else + { + /* Set newitem->child and move to it */ + newitem->child = newchild; + next = newchild; + } + child = child->next; + } - return newitem; + return newitem; fail: - if(newitem != NULL) { - cJSON_Delete(newitem); - } + if (newitem != NULL) + { + cJSON_Delete(newitem); + } - return NULL; + return NULL; } CJSON_PUBLIC(void) cJSON_Minify(char *json) { - unsigned char *into = (unsigned char *) json; + unsigned char *into = (unsigned char*)json; - if(json == NULL) { - return; - } + if (json == NULL) + { + return; + } - while(*json) { - if(*json == ' ') { - json++; - } else if(*json == '\t') { - /* Whitespace characters. */ - json++; - } else if(*json == '\r') { - json++; - } else if(*json == '\n') { - json++; - } else if((*json == '/') && - (json[1] == '/')) - { - /* double-slash comments, to end of line. */ - while(*json && - (*json != '\n')) - { - json++; - } - } else if((*json == '/') && - (json[1] == '*')) - { - /* multiline comments. */ - while(*json && - !((*json == '*') && - (json[1] == '/'))) - { - json++; - } - json += 2; - } else if(*json == '\"') { - /* string literals, which are \" sensitive. */ - *into++ = (unsigned char) *json++; - while(*json && - (*json != '\"')) - { - if(*json == '\\') { - *into++ = (unsigned char) *json++; - } - *into++ = (unsigned char) *json++; - } - *into++ = (unsigned char) *json++; - } else { - /* All other characters. */ - *into++ = (unsigned char) *json++; - } - } + while (*json) + { + if (*json == ' ') + { + json++; + } + else if (*json == '\t') + { + /* Whitespace characters. */ + json++; + } + else if (*json == '\r') + { + json++; + } + else if (*json=='\n') + { + json++; + } + else if ((*json == '/') && (json[1] == '/')) + { + /* double-slash comments, to end of line. */ + while (*json && (*json != '\n')) + { + json++; + } + } + else if ((*json == '/') && (json[1] == '*')) + { + /* multiline comments. */ + while (*json && !((*json == '*') && (json[1] == '/'))) + { + json++; + } + json += 2; + } + else if (*json == '\"') + { + /* string literals, which are \" sensitive. */ + *into++ = (unsigned char)*json++; + while (*json && (*json != '\"')) + { + if (*json == '\\') + { + *into++ = (unsigned char)*json++; + } + *into++ = (unsigned char)*json++; + } + *into++ = (unsigned char)*json++; + } + else + { + /* All other characters. */ + *into++ = (unsigned char)*json++; + } + } - /* and null-terminate. */ - *into = '\0'; + /* and null-terminate. */ + *into = '\0'; } CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & 0xFF) == cJSON_Invalid; + return (item->type & 0xFF) == cJSON_Invalid; } CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & 0xFF) == cJSON_False; + return (item->type & 0xFF) == cJSON_False; } CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & 0xff) == cJSON_True; + return (item->type & 0xff) == cJSON_True; } CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & (cJSON_True | cJSON_False)) != 0; + return (item->type & (cJSON_True | cJSON_False)) != 0; } CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & 0xFF) == cJSON_NULL; + return (item->type & 0xFF) == cJSON_NULL; } CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & 0xFF) == cJSON_Number; + return (item->type & 0xFF) == cJSON_Number; } CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & 0xFF) == cJSON_String; + return (item->type & 0xFF) == cJSON_String; } CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & 0xFF) == cJSON_Array; + return (item->type & 0xFF) == cJSON_Array; } CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & 0xFF) == cJSON_Object; + return (item->type & 0xFF) == cJSON_Object; } CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item) { - if(item == NULL) { - return false; - } + if (item == NULL) + { + return false; + } - return (item->type & 0xFF) == cJSON_Raw; + return (item->type & 0xFF) == cJSON_Raw; } -CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, - const cJSON * const b, - const cJSON_bool case_sensitive) +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) { - if((a == NULL) || - (b == NULL) || - ((a->type & 0xFF) != (b->type & 0xFF)) || - cJSON_IsInvalid(a)) - { - return false; - } + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a)) + { + return false; + } - /* check if type is valid */ - switch(a->type & 0xFF) { - case cJSON_False: - case cJSON_True: - case cJSON_NULL: - case cJSON_Number: - case cJSON_String: - case cJSON_Raw: - case cJSON_Array: - case cJSON_Object: - break; + /* check if type is valid */ + switch (a->type & 0xFF) + { + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + case cJSON_Number: + case cJSON_String: + case cJSON_Raw: + case cJSON_Array: + case cJSON_Object: + break; - default: - return false; - } + default: + return false; + } - /* identical objects are equal */ - if(a == b) { - return true; - } + /* identical objects are equal */ + if (a == b) + { + return true; + } - switch(a->type & 0xFF) { - /* in these cases and equal type is enough */ - case cJSON_False: - case cJSON_True: - case cJSON_NULL: - return true; + switch (a->type & 0xFF) + { + /* in these cases and equal type is enough */ + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + return true; - case cJSON_Number: - if(a->valuedouble == b->valuedouble) { - return true; - } - return false; + case cJSON_Number: + if (a->valuedouble == b->valuedouble) + { + return true; + } + return false; - case cJSON_String: - case cJSON_Raw: - if((a->valuestring == NULL) || - (b->valuestring == NULL)) - { - return false; - } - if(strcmp(a->valuestring, b->valuestring) == 0) { - return true; - } + case cJSON_String: + case cJSON_Raw: + if ((a->valuestring == NULL) || (b->valuestring == NULL)) + { + return false; + } + if (strcmp(a->valuestring, b->valuestring) == 0) + { + return true; + } - return false; + return false; - case cJSON_Array: - { - cJSON *a_element = a->child; - cJSON *b_element = b->child; + case cJSON_Array: + { + cJSON *a_element = a->child; + cJSON *b_element = b->child; - for( ; (a_element != NULL) && - (b_element != NULL); ) - { - if(!cJSON_Compare(a_element, b_element, - case_sensitive)) { - return false; - } + for (; (a_element != NULL) && (b_element != NULL);) + { + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } - a_element = a_element->next; - b_element = b_element->next; - } + a_element = a_element->next; + b_element = b_element->next; + } - /* one of the arrays is longer than the other */ - if(a_element != b_element) { - return false; - } + /* one of the arrays is longer than the other */ + if (a_element != b_element) { + return false; + } - return true; - } + return true; + } - case cJSON_Object: - { - cJSON *a_element = NULL; - cJSON *b_element = NULL; - cJSON_ArrayForEach(a_element, a) - { - /* TODO This has O(n^2) runtime, which is horrible! */ - b_element = get_object_item(b, a_element->string, - case_sensitive); - if(b_element == NULL) { - return false; - } + case cJSON_Object: + { + cJSON *a_element = NULL; + cJSON *b_element = NULL; + cJSON_ArrayForEach(a_element, a) + { + /* TODO This has O(n^2) runtime, which is horrible! */ + b_element = get_object_item(b, a_element->string, case_sensitive); + if (b_element == NULL) + { + return false; + } - if(!cJSON_Compare(a_element, b_element, - case_sensitive)) { - return false; - } - } + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + } - /* doing this twice, once on a and b to prevent true comparison if a subset of b - * TODO: Do this the proper way, this is just a fix for now */ - cJSON_ArrayForEach(b_element, b) - { - a_element = get_object_item(a, b_element->string, - case_sensitive); - if(a_element == NULL) { - return false; - } + /* doing this twice, once on a and b to prevent true comparison if a subset of b + * TODO: Do this the proper way, this is just a fix for now */ + cJSON_ArrayForEach(b_element, b) + { + a_element = get_object_item(a, b_element->string, case_sensitive); + if (a_element == NULL) + { + return false; + } - if(!cJSON_Compare(b_element, a_element, - case_sensitive)) { - return false; - } - } + if (!cJSON_Compare(b_element, a_element, case_sensitive)) + { + return false; + } + } - return true; - } + return true; + } - default: - return false; - } + default: + return false; + } } CJSON_PUBLIC(void *) cJSON_malloc(size_t size) { - return global_hooks.allocate(size); + return global_hooks.allocate(size); } CJSON_PUBLIC(void) cJSON_free(void *object) { - global_hooks.deallocate(object); + global_hooks.deallocate(object); } diff --git a/samples/client/petstore/c/external/cJSON.h b/samples/client/petstore/c/external/cJSON.h index f35925db6ff..6e0bde93204 100644 --- a/samples/client/petstore/c/external/cJSON.h +++ b/samples/client/petstore/c/external/cJSON.h @@ -1,24 +1,24 @@ /* - Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - */ + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ #ifndef cJSON__h #define cJSON__h @@ -37,94 +37,87 @@ extern "C" /* cJSON Types: */ #define cJSON_Invalid (0) -#define cJSON_False (1 << 0) -#define cJSON_True (1 << 1) -#define cJSON_NULL (1 << 2) +#define cJSON_False (1 << 0) +#define cJSON_True (1 << 1) +#define cJSON_NULL (1 << 2) #define cJSON_Number (1 << 3) #define cJSON_String (1 << 4) -#define cJSON_Array (1 << 5) +#define cJSON_Array (1 << 5) #define cJSON_Object (1 << 6) -#define cJSON_Raw (1 << 7) /* raw json */ +#define cJSON_Raw (1 << 7) /* raw json */ #define cJSON_IsReference 256 #define cJSON_StringIsConst 512 /* The cJSON structure: */ -typedef struct cJSON { - /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ - struct cJSON *next; - struct cJSON *prev; - /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ - struct cJSON *child; +typedef struct cJSON +{ + /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ + struct cJSON *next; + struct cJSON *prev; + /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ + struct cJSON *child; - /* The type of the item, as above. */ - int type; + /* The type of the item, as above. */ + int type; - /* The item's string, if type==cJSON_String and type == cJSON_Raw */ - char *valuestring; - /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */ - int valueint; - /* The item's number, if type==cJSON_Number */ - double valuedouble; + /* The item's string, if type==cJSON_String and type == cJSON_Raw */ + char *valuestring; + /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */ + int valueint; + /* The item's number, if type==cJSON_Number */ + double valuedouble; - /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ - char *string; + /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ + char *string; } cJSON; -typedef struct cJSON_Hooks { - void *(*malloc_fn)(size_t sz); - void (*free_fn)(void *ptr); +typedef struct cJSON_Hooks +{ + void *(*malloc_fn)(size_t sz); + void (*free_fn)(void *ptr); } cJSON_Hooks; typedef int cJSON_bool; -#if !defined(__WINDOWS__) && \ - (defined(WIN32) || \ - defined(WIN64) || \ - defined(_MSC_VER) || \ - defined(_WIN32)) +#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) #define __WINDOWS__ #endif #ifdef __WINDOWS__ /* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 2 define options: - CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols - CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) - CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol +CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols +CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) +CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol - For *nix builds that support visibility attribute, you can define similar behavior by +For *nix builds that support visibility attribute, you can define similar behavior by - setting default visibility to hidden by adding - -fvisibility=hidden (for gcc) - or - -xldscope=hidden (for sun cc) - to CFLAGS +setting default visibility to hidden by adding +-fvisibility=hidden (for gcc) +or +-xldscope=hidden (for sun cc) +to CFLAGS - then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does +then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does - */ +*/ /* export symbols by default, this is necessary for copy pasting the C and header file */ -#if !defined(CJSON_HIDE_SYMBOLS) && \ - !defined(CJSON_IMPORT_SYMBOLS) && \ - !defined(CJSON_EXPORT_SYMBOLS) +#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS) #define CJSON_EXPORT_SYMBOLS #endif #if defined(CJSON_HIDE_SYMBOLS) -#define CJSON_PUBLIC(type) type __stdcall +#define CJSON_PUBLIC(type) type __stdcall #elif defined(CJSON_EXPORT_SYMBOLS) -#define CJSON_PUBLIC(type) __declspec(dllexport) type __stdcall +#define CJSON_PUBLIC(type) __declspec(dllexport) type __stdcall #elif defined(CJSON_IMPORT_SYMBOLS) -#define CJSON_PUBLIC(type) __declspec(dllimport) type __stdcall +#define CJSON_PUBLIC(type) __declspec(dllimport) type __stdcall #endif #else /* !WIN32 */ -#if (defined(__GNUC__) || \ - defined(__SUNPRO_CC) || \ - defined(__SUNPRO_C)) && \ - defined(CJSON_API_VISIBILITY) -#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type +#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY) +#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type #else #define CJSON_PUBLIC(type) type #endif @@ -137,51 +130,43 @@ typedef int cJSON_bool; #endif /* returns the version of cJSON as a string */ -CJSON_PUBLIC(const char *) cJSON_Version(void); +CJSON_PUBLIC(const char*) cJSON_Version(void); /* Supply malloc, realloc and free functions to cJSON */ -CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks * hooks); +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks); /* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */ /* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); /* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ /* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */ -CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, - const char **return_parse_end, - cJSON_bool require_null_terminated); +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); /* Render a cJSON entity to text for transfer/storage. */ -CJSON_PUBLIC(char *) cJSON_Print(const cJSON * item); +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); /* Render a cJSON entity to text for transfer/storage without any formatting. */ -CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON * item); +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); /* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ -CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON * item, int prebuffer, - cJSON_bool fmt); +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); /* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */ /* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */ -CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON * item, char *buffer, - const int length, - const cJSON_bool format); +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); /* Delete a cJSON entity and all subentities. */ -CJSON_PUBLIC(void) cJSON_Delete(cJSON * c); +CJSON_PUBLIC(void) cJSON_Delete(cJSON *c); /* Returns the number of items in an array (or object). */ -CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON * array); +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array); /* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */ -CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON * array, int index); +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index); /* Get item "string" from object. Case insensitive. */ -CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, - const char *const string); -CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive( - const cJSON * const object, const char *const string); -CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON * object, - const char *string); +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string); +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string); /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void); /* Check if the item is a string and return its valuestring */ -CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON * item); +CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item); /* These functions check the type of an item */ CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item); @@ -212,8 +197,8 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void); CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string); /* Create an object/arrray that only references it's elements so * they will not be freed by cJSON_Delete */ -CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON * child); -CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON * child); +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child); +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child); /* These utilities create an Array of count items. */ CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count); @@ -222,109 +207,64 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count); CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count); /* Append item to the specified array/object. */ -CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON * array, cJSON * item); -CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON * object, const char *string, - cJSON * item); +CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before * writing to `item->string` */ -CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON * object, const char *string, - cJSON * item); +CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ -CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON * array, cJSON * item); -CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON * object, - const char *string, - cJSON * item); +CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); /* Remove/Detatch items from Arrays/Objects. */ -CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON * parent, - cJSON * const item); -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON * array, int which); -CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON * array, int which); -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON * object, - const char *string); -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON * object, - const char *string); -CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON * object, - const char *string); -CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON * object, - const char *string); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which); +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string); +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); /* Update array items. */ -CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON * array, int which, - cJSON * newitem); /* Shifts pre-existing items to the right. */ -CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, - cJSON * const item, - cJSON * replacement); -CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON * array, int which, - cJSON * newitem); -CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON * object, const char *string, - cJSON * newitem); -CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON * object, - const char *string, - cJSON * newitem); +CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); /* Duplicate a cJSON item */ -CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON * item, cJSON_bool recurse); +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); /* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will - need to be released. With recurse!=0, it will duplicate any children connected to the item. - The item->next and ->prev pointers are always zero on return from Duplicate. */ +need to be released. With recurse!=0, it will duplicate any children connected to the item. +The item->next and ->prev pointers are always zero on return from Duplicate. */ /* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */ -CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, - const cJSON * const b, - const cJSON_bool case_sensitive); +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive); CJSON_PUBLIC(void) cJSON_Minify(char *json); /* Helper functions for creating and adding items to an object at the same time. * They return the added item or NULL on failure. */ -CJSON_PUBLIC(cJSON *) cJSON_AddNullToObject(cJSON * const object, - const char *const name); -CJSON_PUBLIC(cJSON *) cJSON_AddTrueToObject(cJSON * const object, - const char *const name); -CJSON_PUBLIC(cJSON *) cJSON_AddFalseToObject(cJSON * const object, - const char *const name); -CJSON_PUBLIC(cJSON *) cJSON_AddBoolToObject(cJSON * const object, - const char *const name, - const cJSON_bool boolean); -CJSON_PUBLIC(cJSON *) cJSON_AddNumberToObject(cJSON * const object, - const char *const name, - const double number); -CJSON_PUBLIC(cJSON *) cJSON_AddStringToObject(cJSON * const object, - const char *const name, - const char *const string); -CJSON_PUBLIC(cJSON *) cJSON_AddRawToObject(cJSON * const object, - const char *const name, - const char *const raw); -CJSON_PUBLIC(cJSON *) cJSON_AddObjectToObject(cJSON * const object, - const char *const name); -CJSON_PUBLIC(cJSON *) cJSON_AddArrayToObject(cJSON * const object, - const char *const name); +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean); +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number); +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string); +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw); +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name); /* When assigning an integer value, it needs to be propagated to valuedouble too. */ -#define cJSON_SetIntValue(object, \ - number) ((object) ? (object)->valueint = \ - (object)->valuedouble = \ - (number) : (number)) +#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) /* helper for the cJSON_SetNumberValue macro */ -CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON * object, double number); -#define cJSON_SetNumberValue(object, \ - number) ((object != \ - NULL) ? cJSON_SetNumberHelper(object, \ - ( \ - double) \ - number) : ( \ - number)) +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number); +#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number)) /* Macro for iterating over an array or object */ -#define cJSON_ArrayForEach(element, array) for(element = \ - (array != \ - NULL) ? (array)->child : \ - NULL; \ - element != NULL; \ - element = element->next) +#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) /* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */ CJSON_PUBLIC(void *) cJSON_malloc(size_t size); diff --git a/samples/client/petstore/c/include/apiClient.h b/samples/client/petstore/c/include/apiClient.h index a000be9df12..aea3ec93738 100644 --- a/samples/client/petstore/c/include/apiClient.h +++ b/samples/client/petstore/c/include/apiClient.h @@ -10,27 +10,24 @@ #include "../include/keyValuePair.h" typedef struct apiClient_t { - char *basePath; - void *dataReceived; - long response_code; - list_t *apiKeys; - char *accessToken; + char *basePath; + void *dataReceived; + long response_code; + list_t *apiKeys; + char *accessToken; } apiClient_t; -typedef struct binary_t { - uint8_t *data; - unsigned int len; +typedef struct binary_t +{ + uint8_t* data; + unsigned int len; } binary_t; -apiClient_t *apiClient_create(); +apiClient_t* apiClient_create(); void apiClient_free(apiClient_t *apiClient); -void apiClient_invoke(apiClient_t *apiClient, char *operationParameter, - list_t *queryParameters, list_t *headerParameters, - list_t *formParameters, list_t *headerType, - list_t *contentType, char *bodyParameters, - char *requestType); +void apiClient_invoke(apiClient_t *apiClient,char* operationParameter, list_t *queryParameters, list_t *headerParameters, list_t *formParameters,list_t *headerType,list_t *contentType, char *bodyParameters, char *requestType); char *strReplace(char *orig, char *rep, char *with); diff --git a/samples/client/petstore/c/include/keyValuePair.h b/samples/client/petstore/c/include/keyValuePair.h index 710b46f30e3..90f92e71f66 100644 --- a/samples/client/petstore/c/include/keyValuePair.h +++ b/samples/client/petstore/c/include/keyValuePair.h @@ -1,11 +1,11 @@ #ifndef _keyValuePair_H_ #define _keyValuePair_H_ -#include +#include typedef struct keyValuePair_t { - char *key; - void *value; + char* key; + void* value; } keyValuePair_t; keyValuePair_t *keyValuePair_create(char *key, void *value); diff --git a/samples/client/petstore/c/include/list.h b/samples/client/petstore/c/include/list.h index ae35304139c..7d98d7f306b 100644 --- a/samples/client/petstore/c/include/list.h +++ b/samples/client/petstore/c/include/list.h @@ -9,40 +9,31 @@ typedef struct list_t list_t; typedef struct listEntry_t listEntry_t; struct listEntry_t { - listEntry_t *nextListEntry; - listEntry_t *prevListEntry; - void *data; + listEntry_t* nextListEntry; + listEntry_t* prevListEntry; + void* data; }; typedef struct list_t { - listEntry_t *firstEntry; - listEntry_t *lastEntry; + listEntry_t *firstEntry; + listEntry_t *lastEntry; - long count; + long count; } list_t; -#define list_ForEach(element, list) for(element = \ - (list != \ - NULL) ? (list)->firstEntry : \ - NULL; \ - element != NULL; \ - element = element->nextListEntry) +#define list_ForEach(element, list) for(element = (list != NULL) ? (list)->firstEntry : NULL; element != NULL; element = element->nextListEntry) -list_t *list_create(); -void list_free(list_t *listToFree); +list_t* list_create(); +void list_free(list_t* listToFree); -void list_addElement(list_t *list, void *dataToAddInList); -listEntry_t *list_getElementAt(list_t *list, long indexOfElement); -listEntry_t *list_getWithIndex(list_t *list, int index); -void list_removeElement(list_t *list, listEntry_t *elementToRemove); +void list_addElement(list_t* list, void* dataToAddInList); +listEntry_t* list_getElementAt(list_t *list, long indexOfElement); +listEntry_t* list_getWithIndex(list_t* list, int index); +void list_removeElement(list_t* list, listEntry_t* elementToRemove); -void list_iterateThroughListForward(list_t *list, void (*operationToPerform)( - listEntry_t *, - void *), void *additionalDataNeededForCallbackFunction); -void list_iterateThroughListBackward(list_t *list, void (*operationToPerform)( - listEntry_t *, - void *), void *additionalDataNeededForCallbackFunction); +void list_iterateThroughListForward(list_t* list, void (*operationToPerform)(listEntry_t*, void*), void *additionalDataNeededForCallbackFunction); +void list_iterateThroughListBackward(list_t* list, void (*operationToPerform)(listEntry_t*, void*), void *additionalDataNeededForCallbackFunction); -void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData); +void listEntry_printAsInt(listEntry_t* listEntry, void *additionalData); void listEntry_free(listEntry_t *listEntry, void *additionalData); #endif // INCLUDE_LIST_H diff --git a/samples/client/petstore/c/model/api_response.c b/samples/client/petstore/c/model/api_response.c index 3201624063c..c7d728c2f89 100644 --- a/samples/client/petstore/c/model/api_response.c +++ b/samples/client/petstore/c/model/api_response.c @@ -5,104 +5,104 @@ -api_response_t *api_response_create(int code, char *type, char *message) { - api_response_t *api_response_local_var = malloc(sizeof(api_response_t)); - if(!api_response_local_var) { - return NULL; - } - api_response_local_var->code = code; - api_response_local_var->type = type; - api_response_local_var->message = message; +api_response_t *api_response_create( + int code, + char *type, + char *message + ) { + api_response_t *api_response_local_var = malloc(sizeof(api_response_t)); + if (!api_response_local_var) { + return NULL; + } + api_response_local_var->code = code; + api_response_local_var->type = type; + api_response_local_var->message = message; - return api_response_local_var; + return api_response_local_var; } void api_response_free(api_response_t *api_response) { - listEntry_t *listEntry; - free(api_response->type); - free(api_response->message); - free(api_response); + listEntry_t *listEntry; + free(api_response->type); + free(api_response->message); + free(api_response); } cJSON *api_response_convertToJSON(api_response_t *api_response) { - cJSON *item = cJSON_CreateObject(); + cJSON *item = cJSON_CreateObject(); - // api_response->code - if(api_response->code) { - if(cJSON_AddNumberToObject(item, "code", - api_response->code) == NULL) - { - goto fail; // Numeric - } - } + // api_response->code + if(api_response->code) { + if(cJSON_AddNumberToObject(item, "code", api_response->code) == NULL) { + goto fail; //Numeric + } + } - // api_response->type - if(api_response->type) { - if(cJSON_AddStringToObject(item, "type", - api_response->type) == NULL) - { - goto fail; // String - } - } + // api_response->type + if(api_response->type) { + if(cJSON_AddStringToObject(item, "type", api_response->type) == NULL) { + goto fail; //String + } + } - // api_response->message - if(api_response->message) { - if(cJSON_AddStringToObject(item, "message", - api_response->message) == NULL) - { - goto fail; // String - } - } + // api_response->message + if(api_response->message) { + if(cJSON_AddStringToObject(item, "message", api_response->message) == NULL) { + goto fail; //String + } + } - return item; + return item; fail: - if(item) { - cJSON_Delete(item); - } - return NULL; + if (item) { + cJSON_Delete(item); + } + return NULL; } -api_response_t *api_response_parseFromJSON(cJSON *api_responseJSON) { - api_response_t *api_response_local_var = NULL; +api_response_t *api_response_parseFromJSON(cJSON *api_responseJSON){ - // api_response->code - cJSON *code = - cJSON_GetObjectItemCaseSensitive(api_responseJSON, "code"); - if(code) { - if(!cJSON_IsNumber(code)) { - goto end; // Numeric - } - } + api_response_t *api_response_local_var = NULL; - // api_response->type - cJSON *type = - cJSON_GetObjectItemCaseSensitive(api_responseJSON, "type"); - if(type) { - if(!cJSON_IsString(type)) { - goto end; // String - } - } + // api_response->code + cJSON *code = cJSON_GetObjectItemCaseSensitive(api_responseJSON, "code"); + if (code) { + if(!cJSON_IsNumber(code)) + { + goto end; //Numeric + } + } - // api_response->message - cJSON *message = cJSON_GetObjectItemCaseSensitive(api_responseJSON, - "message"); - if(message) { - if(!cJSON_IsString(message)) { - goto end; // String - } - } + // api_response->type + cJSON *type = cJSON_GetObjectItemCaseSensitive(api_responseJSON, "type"); + if (type) { + if(!cJSON_IsString(type)) + { + goto end; //String + } + } + + // api_response->message + cJSON *message = cJSON_GetObjectItemCaseSensitive(api_responseJSON, "message"); + if (message) { + if(!cJSON_IsString(message)) + { + goto end; //String + } + } - api_response_local_var = api_response_create( - code ? code->valuedouble : 0, - type ? strdup(type->valuestring) : NULL, - message ? strdup(message->valuestring) : NULL - ); + api_response_local_var = api_response_create ( + code ? code->valuedouble : 0, + type ? strdup(type->valuestring) : NULL, + message ? strdup(message->valuestring) : NULL + ); - return api_response_local_var; + return api_response_local_var; end: - return NULL; + return NULL; + } diff --git a/samples/client/petstore/c/model/api_response.h b/samples/client/petstore/c/model/api_response.h index 73e92795eec..0b0866e3d5a 100644 --- a/samples/client/petstore/c/model/api_response.h +++ b/samples/client/petstore/c/model/api_response.h @@ -15,12 +15,17 @@ typedef struct api_response_t { - int code; // numeric - char *type; // string - char *message; // string + int code; //numeric + char *type; // string + char *message; // string + } api_response_t; -api_response_t *api_response_create(int code, char *type, char *message); +api_response_t *api_response_create( + int code, + char *type, + char *message +); void api_response_free(api_response_t *api_response); @@ -29,3 +34,4 @@ api_response_t *api_response_parseFromJSON(cJSON *api_responseJSON); cJSON *api_response_convertToJSON(api_response_t *api_response); #endif /* _api_response_H_ */ + diff --git a/samples/client/petstore/c/model/category.c b/samples/client/petstore/c/model/category.c index fe44d0afc96..518ccaee869 100644 --- a/samples/client/petstore/c/model/category.c +++ b/samples/client/petstore/c/model/category.c @@ -5,78 +5,83 @@ -category_t *category_create(long id, char *name) { - category_t *category_local_var = malloc(sizeof(category_t)); - if(!category_local_var) { - return NULL; - } - category_local_var->id = id; - category_local_var->name = name; +category_t *category_create( + long id, + char *name + ) { + category_t *category_local_var = malloc(sizeof(category_t)); + if (!category_local_var) { + return NULL; + } + category_local_var->id = id; + category_local_var->name = name; - return category_local_var; + return category_local_var; } void category_free(category_t *category) { - listEntry_t *listEntry; - free(category->name); - free(category); + listEntry_t *listEntry; + free(category->name); + free(category); } cJSON *category_convertToJSON(category_t *category) { - cJSON *item = cJSON_CreateObject(); + cJSON *item = cJSON_CreateObject(); - // category->id - if(category->id) { - if(cJSON_AddNumberToObject(item, "id", category->id) == NULL) { - goto fail; // Numeric - } - } + // category->id + if(category->id) { + if(cJSON_AddNumberToObject(item, "id", category->id) == NULL) { + goto fail; //Numeric + } + } - // category->name - if(category->name) { - if(cJSON_AddStringToObject(item, "name", - category->name) == NULL) - { - goto fail; // String - } - } + // category->name + if(category->name) { + if(cJSON_AddStringToObject(item, "name", category->name) == NULL) { + goto fail; //String + } + } - return item; + return item; fail: - if(item) { - cJSON_Delete(item); - } - return NULL; + if (item) { + cJSON_Delete(item); + } + return NULL; } -category_t *category_parseFromJSON(cJSON *categoryJSON) { - category_t *category_local_var = NULL; +category_t *category_parseFromJSON(cJSON *categoryJSON){ - // category->id - cJSON *id = cJSON_GetObjectItemCaseSensitive(categoryJSON, "id"); - if(id) { - if(!cJSON_IsNumber(id)) { - goto end; // Numeric - } - } + category_t *category_local_var = NULL; - // category->name - cJSON *name = cJSON_GetObjectItemCaseSensitive(categoryJSON, "name"); - if(name) { - if(!cJSON_IsString(name)) { - goto end; // String - } - } + // category->id + cJSON *id = cJSON_GetObjectItemCaseSensitive(categoryJSON, "id"); + if (id) { + if(!cJSON_IsNumber(id)) + { + goto end; //Numeric + } + } + + // category->name + cJSON *name = cJSON_GetObjectItemCaseSensitive(categoryJSON, "name"); + if (name) { + if(!cJSON_IsString(name)) + { + goto end; //String + } + } - category_local_var = category_create( - id ? id->valuedouble : 0, - name ? strdup(name->valuestring) : NULL - ); + category_local_var = category_create ( + id ? id->valuedouble : 0, + name ? strdup(name->valuestring) : NULL + ); - return category_local_var; + return category_local_var; end: - return NULL; + return NULL; + } diff --git a/samples/client/petstore/c/model/category.h b/samples/client/petstore/c/model/category.h index 27c9387e2f5..e63a04e096c 100644 --- a/samples/client/petstore/c/model/category.h +++ b/samples/client/petstore/c/model/category.h @@ -15,11 +15,15 @@ typedef struct category_t { - long id; // numeric - char *name; // string + long id; //numeric + char *name; // string + } category_t; -category_t *category_create(long id, char *name); +category_t *category_create( + long id, + char *name +); void category_free(category_t *category); @@ -28,3 +32,4 @@ category_t *category_parseFromJSON(cJSON *categoryJSON); cJSON *category_convertToJSON(category_t *category); #endif /* _category_H_ */ + diff --git a/samples/client/petstore/c/model/object.c b/samples/client/petstore/c/model/object.c index 410c31b6c6b..d106693842f 100644 --- a/samples/client/petstore/c/model/object.c +++ b/samples/client/petstore/c/model/object.c @@ -4,28 +4,28 @@ #include "object.h" object_t *object_create() { - object_t *object = malloc(sizeof(object_t)); + object_t *object = malloc(sizeof(object_t)); - return object; + return object; } void object_free(object_t *object) { - free(object); + free (object); } cJSON *object_convertToJSON(object_t *object) { - cJSON *item = cJSON_CreateObject(); + cJSON *item = cJSON_CreateObject(); - return item; + return item; fail: - cJSON_Delete(item); - return NULL; + cJSON_Delete(item); + return NULL; } -object_t *object_parseFromJSON(char *jsonString) { - object_t *object = NULL; +object_t *object_parseFromJSON(char *jsonString){ + object_t *object = NULL; - return object; + return object; end: - return NULL; + return NULL; } diff --git a/samples/client/petstore/c/model/object.h b/samples/client/petstore/c/model/object.h index 1dad2093fed..6b1a77fc508 100644 --- a/samples/client/petstore/c/model/object.h +++ b/samples/client/petstore/c/model/object.h @@ -12,7 +12,7 @@ typedef struct object_t { - void *temporary; + void *temporary; } object_t; object_t *object_create(); diff --git a/samples/client/petstore/c/model/order.c b/samples/client/petstore/c/model/order.c index de4c3db1959..5aafbecba35 100644 --- a/samples/client/petstore/c/model/order.c +++ b/samples/client/petstore/c/model/order.c @@ -4,182 +4,184 @@ #include "order.h" -char *statusorder_ToString(status_e status) { - char *statusArray[] = { "placed", "approved", "delivered" }; - return statusArray[status]; -} + char* statusorder_ToString(status_e status){ + char *statusArray[] = { "placed","approved","delivered" }; + return statusArray[status]; + } -status_e statusorder_FromString(char *status) { - int stringToReturn = 0; - char *statusArray[] = { "placed", "approved", "delivered" }; - size_t sizeofArray = sizeof(statusArray) / sizeof(statusArray[0]); - while(stringToReturn < sizeofArray) { - if(strcmp(status, statusArray[stringToReturn]) == 0) { - return stringToReturn; - } - stringToReturn++; - } - return 0; -} + status_e statusorder_FromString(char* status){ + int stringToReturn = 0; + char *statusArray[] = { "placed","approved","delivered" }; + size_t sizeofArray = sizeof(statusArray) / sizeof(statusArray[0]); + while(stringToReturn < sizeofArray) { + if(strcmp(status, statusArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; + } -order_t *order_create(long id, long petId, int quantity, char *shipDate, - status_e status, int complete) { - order_t *order_local_var = malloc(sizeof(order_t)); - if(!order_local_var) { - return NULL; - } - order_local_var->id = id; - order_local_var->petId = petId; - order_local_var->quantity = quantity; - order_local_var->shipDate = shipDate; - order_local_var->status = status; - order_local_var->complete = complete; +order_t *order_create( + long id, + long petId, + int quantity, + char *shipDate, + status_e status, + int complete + ) { + order_t *order_local_var = malloc(sizeof(order_t)); + if (!order_local_var) { + return NULL; + } + order_local_var->id = id; + order_local_var->petId = petId; + order_local_var->quantity = quantity; + order_local_var->shipDate = shipDate; + order_local_var->status = status; + order_local_var->complete = complete; - return order_local_var; + return order_local_var; } void order_free(order_t *order) { - listEntry_t *listEntry; - free(order->shipDate); - free(order); + listEntry_t *listEntry; + free(order->shipDate); + free(order); } cJSON *order_convertToJSON(order_t *order) { - cJSON *item = cJSON_CreateObject(); + cJSON *item = cJSON_CreateObject(); - // order->id - if(order->id) { - if(cJSON_AddNumberToObject(item, "id", order->id) == NULL) { - goto fail; // Numeric - } - } + // order->id + if(order->id) { + if(cJSON_AddNumberToObject(item, "id", order->id) == NULL) { + goto fail; //Numeric + } + } - // order->petId - if(order->petId) { - if(cJSON_AddNumberToObject(item, "petId", - order->petId) == NULL) - { - goto fail; // Numeric - } - } + // order->petId + if(order->petId) { + if(cJSON_AddNumberToObject(item, "petId", order->petId) == NULL) { + goto fail; //Numeric + } + } - // order->quantity - if(order->quantity) { - if(cJSON_AddNumberToObject(item, "quantity", - order->quantity) == NULL) - { - goto fail; // Numeric - } - } + // order->quantity + if(order->quantity) { + if(cJSON_AddNumberToObject(item, "quantity", order->quantity) == NULL) { + goto fail; //Numeric + } + } - // order->shipDate - if(order->shipDate) { - if(cJSON_AddStringToObject(item, "shipDate", - order->shipDate) == NULL) - { - goto fail; // Date-Time - } - } + // order->shipDate + if(order->shipDate) { + if(cJSON_AddStringToObject(item, "shipDate", order->shipDate) == NULL) { + goto fail; //Date-Time + } + } - // order->status - - if(cJSON_AddStringToObject(item, "status", - statusorder_ToString(order->status)) == NULL) - { - goto fail; // Enum - } + // order->status + + if(cJSON_AddStringToObject(item, "status", statusorder_ToString(order->status)) == NULL) + { + goto fail; //Enum + } + + // order->complete + if(order->complete) { + if(cJSON_AddBoolToObject(item, "complete", order->complete) == NULL) { + goto fail; //Bool + } + } - // order->complete - if(order->complete) { - if(cJSON_AddBoolToObject(item, "complete", - order->complete) == NULL) - { - goto fail; // Bool - } - } - - return item; + return item; fail: - if(item) { - cJSON_Delete(item); - } - return NULL; + if (item) { + cJSON_Delete(item); + } + return NULL; } -order_t *order_parseFromJSON(cJSON *orderJSON) { - order_t *order_local_var = NULL; +order_t *order_parseFromJSON(cJSON *orderJSON){ - // order->id - cJSON *id = cJSON_GetObjectItemCaseSensitive(orderJSON, "id"); - if(id) { - if(!cJSON_IsNumber(id)) { - goto end; // Numeric - } - } + order_t *order_local_var = NULL; - // order->petId - cJSON *petId = cJSON_GetObjectItemCaseSensitive(orderJSON, "petId"); - if(petId) { - if(!cJSON_IsNumber(petId)) { - goto end; // Numeric - } - } + // order->id + cJSON *id = cJSON_GetObjectItemCaseSensitive(orderJSON, "id"); + if (id) { + if(!cJSON_IsNumber(id)) + { + goto end; //Numeric + } + } - // order->quantity - cJSON *quantity = - cJSON_GetObjectItemCaseSensitive(orderJSON, "quantity"); - if(quantity) { - if(!cJSON_IsNumber(quantity)) { - goto end; // Numeric - } - } + // order->petId + cJSON *petId = cJSON_GetObjectItemCaseSensitive(orderJSON, "petId"); + if (petId) { + if(!cJSON_IsNumber(petId)) + { + goto end; //Numeric + } + } - // order->shipDate - cJSON *shipDate = - cJSON_GetObjectItemCaseSensitive(orderJSON, "shipDate"); - if(shipDate) { - if(!cJSON_IsString(shipDate)) { - goto end; // DateTime - } - } + // order->quantity + cJSON *quantity = cJSON_GetObjectItemCaseSensitive(orderJSON, "quantity"); + if (quantity) { + if(!cJSON_IsNumber(quantity)) + { + goto end; //Numeric + } + } - // order->status - cJSON *status = cJSON_GetObjectItemCaseSensitive(orderJSON, "status"); - status_e statusVariable; - if(status) { - if(!cJSON_IsString(status)) { - goto end; // Enum - } - statusVariable = statusorder_FromString(status->valuestring); - } + // order->shipDate + cJSON *shipDate = cJSON_GetObjectItemCaseSensitive(orderJSON, "shipDate"); + if (shipDate) { + if(!cJSON_IsString(shipDate)) + { + goto end; //DateTime + } + } - // order->complete - cJSON *complete = - cJSON_GetObjectItemCaseSensitive(orderJSON, "complete"); - if(complete) { - if(!cJSON_IsBool(complete)) { - goto end; // Bool - } - } + // order->status + cJSON *status = cJSON_GetObjectItemCaseSensitive(orderJSON, "status"); + status_e statusVariable; + if (status) { + if(!cJSON_IsString(status)) + { + goto end; //Enum + } + statusVariable = statusorder_FromString(status->valuestring); + } + + // order->complete + cJSON *complete = cJSON_GetObjectItemCaseSensitive(orderJSON, "complete"); + if (complete) { + if(!cJSON_IsBool(complete)) + { + goto end; //Bool + } + } - order_local_var = order_create( - id ? id->valuedouble : 0, - petId ? petId->valuedouble : 0, - quantity ? quantity->valuedouble : 0, - shipDate ? strdup(shipDate->valuestring) : NULL, - status ? statusVariable : -1, - complete ? complete->valueint : 0 - ); + order_local_var = order_create ( + id ? id->valuedouble : 0, + petId ? petId->valuedouble : 0, + quantity ? quantity->valuedouble : 0, + shipDate ? strdup(shipDate->valuestring) : NULL, + status ? statusVariable : -1, + complete ? complete->valueint : 0 + ); - return order_local_var; + return order_local_var; end: - return NULL; + return NULL; + } diff --git a/samples/client/petstore/c/model/order.h b/samples/client/petstore/c/model/order.h index ef99a5da98c..e7f814e1fa1 100644 --- a/samples/client/petstore/c/model/order.h +++ b/samples/client/petstore/c/model/order.h @@ -12,24 +12,31 @@ #include "../include/list.h" #include "../include/keyValuePair.h" -typedef enum { placed, approved, delivered } status_e; + typedef enum { placed, approved, delivered } status_e; -char *status_ToString(status_e status); + char* status_ToString(status_e status); -status_e status_FromString(char *status); + status_e status_FromString(char* status); typedef struct order_t { - long id; // numeric - long petId; // numeric - int quantity; // numeric - char *shipDate; // date time - status_e status; // enum - int complete; // boolean + long id; //numeric + long petId; //numeric + int quantity; //numeric + char *shipDate; //date time + status_e status; //enum + int complete; //boolean + } order_t; -order_t *order_create(long id, long petId, int quantity, char *shipDate, - status_e status, int complete); +order_t *order_create( + long id, + long petId, + int quantity, + char *shipDate, + status_e status, + int complete +); void order_free(order_t *order); @@ -38,3 +45,4 @@ order_t *order_parseFromJSON(cJSON *orderJSON); cJSON *order_convertToJSON(order_t *order); #endif /* _order_H_ */ + diff --git a/samples/client/petstore/c/model/pet.c b/samples/client/petstore/c/model/pet.c index 73b6c4e28f4..b25b785cc6b 100644 --- a/samples/client/petstore/c/model/pet.c +++ b/samples/client/petstore/c/model/pet.c @@ -4,247 +4,251 @@ #include "pet.h" -char *statuspet_ToString(status_e status) { - char *statusArray[] = { "available", "pending", "sold" }; - return statusArray[status]; -} + char* statuspet_ToString(status_e status){ + char *statusArray[] = { "available","pending","sold" }; + return statusArray[status]; + } -status_e statuspet_FromString(char *status) { - int stringToReturn = 0; - char *statusArray[] = { "available", "pending", "sold" }; - size_t sizeofArray = sizeof(statusArray) / sizeof(statusArray[0]); - while(stringToReturn < sizeofArray) { - if(strcmp(status, statusArray[stringToReturn]) == 0) { - return stringToReturn; - } - stringToReturn++; - } - return 0; -} + status_e statuspet_FromString(char* status){ + int stringToReturn = 0; + char *statusArray[] = { "available","pending","sold" }; + size_t sizeofArray = sizeof(statusArray) / sizeof(statusArray[0]); + while(stringToReturn < sizeofArray) { + if(strcmp(status, statusArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; + } -pet_t *pet_create(long id, category_t *category, char *name, list_t *photoUrls, - list_t *tags, status_e status) { - pet_t *pet_local_var = malloc(sizeof(pet_t)); - if(!pet_local_var) { - return NULL; - } - pet_local_var->id = id; - pet_local_var->category = category; - pet_local_var->name = name; - pet_local_var->photoUrls = photoUrls; - pet_local_var->tags = tags; - pet_local_var->status = status; +pet_t *pet_create( + long id, + category_t *category, + char *name, + list_t *photoUrls, + list_t *tags, + status_e status + ) { + pet_t *pet_local_var = malloc(sizeof(pet_t)); + if (!pet_local_var) { + return NULL; + } + pet_local_var->id = id; + pet_local_var->category = category; + pet_local_var->name = name; + pet_local_var->photoUrls = photoUrls; + pet_local_var->tags = tags; + pet_local_var->status = status; - return pet_local_var; + return pet_local_var; } void pet_free(pet_t *pet) { - listEntry_t *listEntry; - category_free(pet->category); - free(pet->name); - list_ForEach(listEntry, pet->photoUrls) { - free(listEntry->data); - } - list_free(pet->photoUrls); - list_ForEach(listEntry, pet->tags) { - tag_free(listEntry->data); - } - list_free(pet->tags); - free(pet); + listEntry_t *listEntry; + category_free(pet->category); + free(pet->name); + list_ForEach(listEntry, pet->photoUrls) { + free(listEntry->data); + } + list_free(pet->photoUrls); + list_ForEach(listEntry, pet->tags) { + tag_free(listEntry->data); + } + list_free(pet->tags); + free(pet); } cJSON *pet_convertToJSON(pet_t *pet) { - cJSON *item = cJSON_CreateObject(); + cJSON *item = cJSON_CreateObject(); - // pet->id - if(pet->id) { - if(cJSON_AddNumberToObject(item, "id", pet->id) == NULL) { - goto fail; // Numeric - } - } + // pet->id + if(pet->id) { + if(cJSON_AddNumberToObject(item, "id", pet->id) == NULL) { + goto fail; //Numeric + } + } - // pet->category - if(pet->category) { - cJSON *category_local_JSON = category_convertToJSON( - pet->category); - if(category_local_JSON == NULL) { - goto fail; // model - } - cJSON_AddItemToObject(item, "category", category_local_JSON); - if(item->child == NULL) { - goto fail; - } - } + // pet->category + if(pet->category) { + cJSON *category_local_JSON = category_convertToJSON(pet->category); + if(category_local_JSON == NULL) { + goto fail; //model + } + cJSON_AddItemToObject(item, "category", category_local_JSON); + if(item->child == NULL) { + goto fail; + } + } - // pet->name - if(!pet->name) { - goto fail; - } - - if(cJSON_AddStringToObject(item, "name", pet->name) == NULL) { - goto fail; // String - } + // pet->name + if (!pet->name) { + goto fail; + } + + if(cJSON_AddStringToObject(item, "name", pet->name) == NULL) { + goto fail; //String + } - // pet->photoUrls - if(!pet->photoUrls) { - goto fail; - } + // pet->photoUrls + if (!pet->photoUrls) { + goto fail; + } + + cJSON *photo_urls = cJSON_AddArrayToObject(item, "photoUrls"); + if(photo_urls == NULL) { + goto fail; //primitive container + } - cJSON *photo_urls = cJSON_AddArrayToObject(item, "photoUrls"); - if(photo_urls == NULL) { - goto fail; // primitive container - } - - listEntry_t *photo_urlsListEntry; - list_ForEach(photo_urlsListEntry, pet->photoUrls) { - if(cJSON_AddStringToObject(photo_urls, "", - (char *) photo_urlsListEntry->data) - == NULL) - { - goto fail; - } - } + listEntry_t *photo_urlsListEntry; + list_ForEach(photo_urlsListEntry, pet->photoUrls) { + if(cJSON_AddStringToObject(photo_urls, "", (char*)photo_urlsListEntry->data) == NULL) + { + goto fail; + } + } - // pet->tags - if(pet->tags) { - cJSON *tags = cJSON_AddArrayToObject(item, "tags"); - if(tags == NULL) { - goto fail; // nonprimitive container - } + // pet->tags + if(pet->tags) { + cJSON *tags = cJSON_AddArrayToObject(item, "tags"); + if(tags == NULL) { + goto fail; //nonprimitive container + } - listEntry_t *tagsListEntry; - if(pet->tags) { - list_ForEach(tagsListEntry, pet->tags) { - cJSON *itemLocal = tag_convertToJSON( - tagsListEntry->data); - if(itemLocal == NULL) { - goto fail; - } - cJSON_AddItemToArray(tags, itemLocal); - } - } - } + listEntry_t *tagsListEntry; + if (pet->tags) { + list_ForEach(tagsListEntry, pet->tags) { + cJSON *itemLocal = tag_convertToJSON(tagsListEntry->data); + if(itemLocal == NULL) { + goto fail; + } + cJSON_AddItemToArray(tags, itemLocal); + } + } + } - // pet->status + // pet->status + + if(cJSON_AddStringToObject(item, "status", statuspet_ToString(pet->status)) == NULL) + { + goto fail; //Enum + } + - if(cJSON_AddStringToObject(item, "status", - statuspet_ToString(pet->status)) == NULL) - { - goto fail; // Enum - } - - - return item; + return item; fail: - if(item) { - cJSON_Delete(item); - } - return NULL; + if (item) { + cJSON_Delete(item); + } + return NULL; } -pet_t *pet_parseFromJSON(cJSON *petJSON) { - pet_t *pet_local_var = NULL; +pet_t *pet_parseFromJSON(cJSON *petJSON){ - // pet->id - cJSON *id = cJSON_GetObjectItemCaseSensitive(petJSON, "id"); - if(id) { - if(!cJSON_IsNumber(id)) { - goto end; // Numeric - } - } + pet_t *pet_local_var = NULL; - // pet->category - cJSON *category = cJSON_GetObjectItemCaseSensitive(petJSON, "category"); - category_t *category_local_nonprim = NULL; - if(category) { - category_local_nonprim = category_parseFromJSON(category); // nonprimitive - } + // pet->id + cJSON *id = cJSON_GetObjectItemCaseSensitive(petJSON, "id"); + if (id) { + if(!cJSON_IsNumber(id)) + { + goto end; //Numeric + } + } - // pet->name - cJSON *name = cJSON_GetObjectItemCaseSensitive(petJSON, "name"); - if(!name) { - goto end; - } + // pet->category + cJSON *category = cJSON_GetObjectItemCaseSensitive(petJSON, "category"); + category_t *category_local_nonprim = NULL; + if (category) { + category_local_nonprim = category_parseFromJSON(category); //nonprimitive + } + + // pet->name + cJSON *name = cJSON_GetObjectItemCaseSensitive(petJSON, "name"); + if (!name) { + goto end; + } + + + if(!cJSON_IsString(name)) + { + goto end; //String + } + + // pet->photoUrls + cJSON *photoUrls = cJSON_GetObjectItemCaseSensitive(petJSON, "photoUrls"); + if (!photoUrls) { + goto end; + } + + list_t *photo_urlsList; + + cJSON *photo_urls_local; + if(!cJSON_IsArray(photoUrls)) { + goto end;//primitive container + } + photo_urlsList = list_create(); + + cJSON_ArrayForEach(photo_urls_local, photoUrls) + { + if(!cJSON_IsString(photo_urls_local)) + { + goto end; + } + list_addElement(photo_urlsList , strdup(photo_urls_local->valuestring)); + } + + // pet->tags + cJSON *tags = cJSON_GetObjectItemCaseSensitive(petJSON, "tags"); + list_t *tagsList; + if (tags) { + cJSON *tags_local_nonprimitive; + if(!cJSON_IsArray(tags)){ + goto end; //nonprimitive container + } + + tagsList = list_create(); + + cJSON_ArrayForEach(tags_local_nonprimitive,tags ) + { + if(!cJSON_IsObject(tags_local_nonprimitive)){ + goto end; + } + tag_t *tagsItem = tag_parseFromJSON(tags_local_nonprimitive); + + list_addElement(tagsList, tagsItem); + } + } + + // pet->status + cJSON *status = cJSON_GetObjectItemCaseSensitive(petJSON, "status"); + status_e statusVariable; + if (status) { + if(!cJSON_IsString(status)) + { + goto end; //Enum + } + statusVariable = statuspet_FromString(status->valuestring); + } - if(!cJSON_IsString(name)) { - goto end; // String - } + pet_local_var = pet_create ( + id ? id->valuedouble : 0, + category ? category_local_nonprim : NULL, + strdup(name->valuestring), + photo_urlsList, + tags ? tagsList : NULL, + status ? statusVariable : -1 + ); - // pet->photoUrls - cJSON *photoUrls = - cJSON_GetObjectItemCaseSensitive(petJSON, "photoUrls"); - if(!photoUrls) { - goto end; - } - - list_t *photo_urlsList; - - cJSON *photo_urls_local; - if(!cJSON_IsArray(photoUrls)) { - goto end; // primitive container - } - photo_urlsList = list_create(); - - cJSON_ArrayForEach(photo_urls_local, photoUrls) - { - if(!cJSON_IsString(photo_urls_local)) { - goto end; - } - list_addElement(photo_urlsList, - strdup(photo_urls_local->valuestring)); - } - - // pet->tags - cJSON *tags = cJSON_GetObjectItemCaseSensitive(petJSON, "tags"); - list_t *tagsList; - if(tags) { - cJSON *tags_local_nonprimitive; - if(!cJSON_IsArray(tags)) { - goto end; // nonprimitive container - } - - tagsList = list_create(); - - cJSON_ArrayForEach(tags_local_nonprimitive, tags) - { - if(!cJSON_IsObject(tags_local_nonprimitive)) { - goto end; - } - tag_t *tagsItem = tag_parseFromJSON( - tags_local_nonprimitive); - - list_addElement(tagsList, tagsItem); - } - } - - // pet->status - cJSON *status = cJSON_GetObjectItemCaseSensitive(petJSON, "status"); - status_e statusVariable; - if(status) { - if(!cJSON_IsString(status)) { - goto end; // Enum - } - statusVariable = statuspet_FromString(status->valuestring); - } - - - pet_local_var = pet_create( - id ? id->valuedouble : 0, - category ? category_local_nonprim : NULL, - strdup(name->valuestring), - photo_urlsList, - tags ? tagsList : NULL, - status ? statusVariable : -1 - ); - - return pet_local_var; + return pet_local_var; end: - return NULL; + return NULL; + } diff --git a/samples/client/petstore/c/model/pet.h b/samples/client/petstore/c/model/pet.h index da5b3df5e7a..a29280648d8 100644 --- a/samples/client/petstore/c/model/pet.h +++ b/samples/client/petstore/c/model/pet.h @@ -14,24 +14,31 @@ #include "category.h" #include "tag.h" -typedef enum { available, pending, sold } status_e; + typedef enum { available, pending, sold } status_e; -char *status_ToString(status_e status); + char* status_ToString(status_e status); -status_e status_FromString(char *status); + status_e status_FromString(char* status); typedef struct pet_t { - long id; // numeric - category_t *category; // model - char *name; // string - list_t *photoUrls; // primitive container - list_t *tags; // nonprimitive container - status_e status; // enum + long id; //numeric + category_t *category; //model + char *name; // string + list_t *photoUrls; //primitive container + list_t *tags; //nonprimitive container + status_e status; //enum + } pet_t; -pet_t *pet_create(long id, category_t *category, char *name, list_t *photoUrls, - list_t *tags, status_e status); +pet_t *pet_create( + long id, + category_t *category, + char *name, + list_t *photoUrls, + list_t *tags, + status_e status +); void pet_free(pet_t *pet); @@ -40,3 +47,4 @@ pet_t *pet_parseFromJSON(cJSON *petJSON); cJSON *pet_convertToJSON(pet_t *pet); #endif /* _pet_H_ */ + diff --git a/samples/client/petstore/c/model/tag.c b/samples/client/petstore/c/model/tag.c index ca6c9e9184e..63450378b9f 100644 --- a/samples/client/petstore/c/model/tag.c +++ b/samples/client/petstore/c/model/tag.c @@ -5,76 +5,83 @@ -tag_t *tag_create(long id, char *name) { - tag_t *tag_local_var = malloc(sizeof(tag_t)); - if(!tag_local_var) { - return NULL; - } - tag_local_var->id = id; - tag_local_var->name = name; +tag_t *tag_create( + long id, + char *name + ) { + tag_t *tag_local_var = malloc(sizeof(tag_t)); + if (!tag_local_var) { + return NULL; + } + tag_local_var->id = id; + tag_local_var->name = name; - return tag_local_var; + return tag_local_var; } void tag_free(tag_t *tag) { - listEntry_t *listEntry; - free(tag->name); - free(tag); + listEntry_t *listEntry; + free(tag->name); + free(tag); } cJSON *tag_convertToJSON(tag_t *tag) { - cJSON *item = cJSON_CreateObject(); + cJSON *item = cJSON_CreateObject(); - // tag->id - if(tag->id) { - if(cJSON_AddNumberToObject(item, "id", tag->id) == NULL) { - goto fail; // Numeric - } - } + // tag->id + if(tag->id) { + if(cJSON_AddNumberToObject(item, "id", tag->id) == NULL) { + goto fail; //Numeric + } + } - // tag->name - if(tag->name) { - if(cJSON_AddStringToObject(item, "name", tag->name) == NULL) { - goto fail; // String - } - } + // tag->name + if(tag->name) { + if(cJSON_AddStringToObject(item, "name", tag->name) == NULL) { + goto fail; //String + } + } - return item; + return item; fail: - if(item) { - cJSON_Delete(item); - } - return NULL; + if (item) { + cJSON_Delete(item); + } + return NULL; } -tag_t *tag_parseFromJSON(cJSON *tagJSON) { - tag_t *tag_local_var = NULL; +tag_t *tag_parseFromJSON(cJSON *tagJSON){ - // tag->id - cJSON *id = cJSON_GetObjectItemCaseSensitive(tagJSON, "id"); - if(id) { - if(!cJSON_IsNumber(id)) { - goto end; // Numeric - } - } + tag_t *tag_local_var = NULL; - // tag->name - cJSON *name = cJSON_GetObjectItemCaseSensitive(tagJSON, "name"); - if(name) { - if(!cJSON_IsString(name)) { - goto end; // String - } - } + // tag->id + cJSON *id = cJSON_GetObjectItemCaseSensitive(tagJSON, "id"); + if (id) { + if(!cJSON_IsNumber(id)) + { + goto end; //Numeric + } + } + + // tag->name + cJSON *name = cJSON_GetObjectItemCaseSensitive(tagJSON, "name"); + if (name) { + if(!cJSON_IsString(name)) + { + goto end; //String + } + } - tag_local_var = tag_create( - id ? id->valuedouble : 0, - name ? strdup(name->valuestring) : NULL - ); + tag_local_var = tag_create ( + id ? id->valuedouble : 0, + name ? strdup(name->valuestring) : NULL + ); - return tag_local_var; + return tag_local_var; end: - return NULL; + return NULL; + } diff --git a/samples/client/petstore/c/model/tag.h b/samples/client/petstore/c/model/tag.h index 235f7b2ea45..26f70686658 100644 --- a/samples/client/petstore/c/model/tag.h +++ b/samples/client/petstore/c/model/tag.h @@ -15,11 +15,15 @@ typedef struct tag_t { - long id; // numeric - char *name; // string + long id; //numeric + char *name; // string + } tag_t; -tag_t *tag_create(long id, char *name); +tag_t *tag_create( + long id, + char *name +); void tag_free(tag_t *tag); @@ -28,3 +32,4 @@ tag_t *tag_parseFromJSON(cJSON *tagJSON); cJSON *tag_convertToJSON(tag_t *tag); #endif /* _tag_H_ */ + diff --git a/samples/client/petstore/c/model/user.c b/samples/client/petstore/c/model/user.c index a12f59bb3d4..b480c68203f 100644 --- a/samples/client/petstore/c/model/user.c +++ b/samples/client/petstore/c/model/user.c @@ -5,209 +5,208 @@ -user_t *user_create(long id, char *username, char *firstName, char *lastName, - char *email, char *password, char *phone, int userStatus) { - user_t *user_local_var = malloc(sizeof(user_t)); - if(!user_local_var) { - return NULL; - } - user_local_var->id = id; - user_local_var->username = username; - user_local_var->firstName = firstName; - user_local_var->lastName = lastName; - user_local_var->email = email; - user_local_var->password = password; - user_local_var->phone = phone; - user_local_var->userStatus = userStatus; +user_t *user_create( + long id, + char *username, + char *firstName, + char *lastName, + char *email, + char *password, + char *phone, + int userStatus + ) { + user_t *user_local_var = malloc(sizeof(user_t)); + if (!user_local_var) { + return NULL; + } + user_local_var->id = id; + user_local_var->username = username; + user_local_var->firstName = firstName; + user_local_var->lastName = lastName; + user_local_var->email = email; + user_local_var->password = password; + user_local_var->phone = phone; + user_local_var->userStatus = userStatus; - return user_local_var; + return user_local_var; } void user_free(user_t *user) { - listEntry_t *listEntry; - free(user->username); - free(user->firstName); - free(user->lastName); - free(user->email); - free(user->password); - free(user->phone); - free(user); + listEntry_t *listEntry; + free(user->username); + free(user->firstName); + free(user->lastName); + free(user->email); + free(user->password); + free(user->phone); + free(user); } cJSON *user_convertToJSON(user_t *user) { - cJSON *item = cJSON_CreateObject(); + cJSON *item = cJSON_CreateObject(); - // user->id - if(user->id) { - if(cJSON_AddNumberToObject(item, "id", user->id) == NULL) { - goto fail; // Numeric - } - } + // user->id + if(user->id) { + if(cJSON_AddNumberToObject(item, "id", user->id) == NULL) { + goto fail; //Numeric + } + } - // user->username - if(user->username) { - if(cJSON_AddStringToObject(item, "username", - user->username) == NULL) - { - goto fail; // String - } - } + // user->username + if(user->username) { + if(cJSON_AddStringToObject(item, "username", user->username) == NULL) { + goto fail; //String + } + } - // user->firstName - if(user->firstName) { - if(cJSON_AddStringToObject(item, "firstName", - user->firstName) == NULL) - { - goto fail; // String - } - } + // user->firstName + if(user->firstName) { + if(cJSON_AddStringToObject(item, "firstName", user->firstName) == NULL) { + goto fail; //String + } + } - // user->lastName - if(user->lastName) { - if(cJSON_AddStringToObject(item, "lastName", - user->lastName) == NULL) - { - goto fail; // String - } - } + // user->lastName + if(user->lastName) { + if(cJSON_AddStringToObject(item, "lastName", user->lastName) == NULL) { + goto fail; //String + } + } - // user->email - if(user->email) { - if(cJSON_AddStringToObject(item, "email", - user->email) == NULL) - { - goto fail; // String - } - } + // user->email + if(user->email) { + if(cJSON_AddStringToObject(item, "email", user->email) == NULL) { + goto fail; //String + } + } - // user->password - if(user->password) { - if(cJSON_AddStringToObject(item, "password", - user->password) == NULL) - { - goto fail; // String - } - } + // user->password + if(user->password) { + if(cJSON_AddStringToObject(item, "password", user->password) == NULL) { + goto fail; //String + } + } - // user->phone - if(user->phone) { - if(cJSON_AddStringToObject(item, "phone", - user->phone) == NULL) - { - goto fail; // String - } - } + // user->phone + if(user->phone) { + if(cJSON_AddStringToObject(item, "phone", user->phone) == NULL) { + goto fail; //String + } + } - // user->userStatus - if(user->userStatus) { - if(cJSON_AddNumberToObject(item, "userStatus", - user->userStatus) == NULL) - { - goto fail; // Numeric - } - } + // user->userStatus + if(user->userStatus) { + if(cJSON_AddNumberToObject(item, "userStatus", user->userStatus) == NULL) { + goto fail; //Numeric + } + } - return item; + return item; fail: - if(item) { - cJSON_Delete(item); - } - return NULL; + if (item) { + cJSON_Delete(item); + } + return NULL; } -user_t *user_parseFromJSON(cJSON *userJSON) { - user_t *user_local_var = NULL; +user_t *user_parseFromJSON(cJSON *userJSON){ - // user->id - cJSON *id = cJSON_GetObjectItemCaseSensitive(userJSON, "id"); - if(id) { - if(!cJSON_IsNumber(id)) { - goto end; // Numeric - } - } + user_t *user_local_var = NULL; - // user->username - cJSON *username = - cJSON_GetObjectItemCaseSensitive(userJSON, "username"); - if(username) { - if(!cJSON_IsString(username)) { - goto end; // String - } - } + // user->id + cJSON *id = cJSON_GetObjectItemCaseSensitive(userJSON, "id"); + if (id) { + if(!cJSON_IsNumber(id)) + { + goto end; //Numeric + } + } - // user->firstName - cJSON *firstName = cJSON_GetObjectItemCaseSensitive(userJSON, - "firstName"); - if(firstName) { - if(!cJSON_IsString(firstName)) { - goto end; // String - } - } + // user->username + cJSON *username = cJSON_GetObjectItemCaseSensitive(userJSON, "username"); + if (username) { + if(!cJSON_IsString(username)) + { + goto end; //String + } + } - // user->lastName - cJSON *lastName = - cJSON_GetObjectItemCaseSensitive(userJSON, "lastName"); - if(lastName) { - if(!cJSON_IsString(lastName)) { - goto end; // String - } - } + // user->firstName + cJSON *firstName = cJSON_GetObjectItemCaseSensitive(userJSON, "firstName"); + if (firstName) { + if(!cJSON_IsString(firstName)) + { + goto end; //String + } + } - // user->email - cJSON *email = cJSON_GetObjectItemCaseSensitive(userJSON, "email"); - if(email) { - if(!cJSON_IsString(email)) { - goto end; // String - } - } + // user->lastName + cJSON *lastName = cJSON_GetObjectItemCaseSensitive(userJSON, "lastName"); + if (lastName) { + if(!cJSON_IsString(lastName)) + { + goto end; //String + } + } - // user->password - cJSON *password = - cJSON_GetObjectItemCaseSensitive(userJSON, "password"); - if(password) { - if(!cJSON_IsString(password)) { - goto end; // String - } - } + // user->email + cJSON *email = cJSON_GetObjectItemCaseSensitive(userJSON, "email"); + if (email) { + if(!cJSON_IsString(email)) + { + goto end; //String + } + } - // user->phone - cJSON *phone = cJSON_GetObjectItemCaseSensitive(userJSON, "phone"); - if(phone) { - if(!cJSON_IsString(phone)) { - goto end; // String - } - } + // user->password + cJSON *password = cJSON_GetObjectItemCaseSensitive(userJSON, "password"); + if (password) { + if(!cJSON_IsString(password)) + { + goto end; //String + } + } - // user->userStatus - cJSON *userStatus = cJSON_GetObjectItemCaseSensitive(userJSON, - "userStatus"); - if(userStatus) { - if(!cJSON_IsNumber(userStatus)) { - goto end; // Numeric - } - } + // user->phone + cJSON *phone = cJSON_GetObjectItemCaseSensitive(userJSON, "phone"); + if (phone) { + if(!cJSON_IsString(phone)) + { + goto end; //String + } + } + + // user->userStatus + cJSON *userStatus = cJSON_GetObjectItemCaseSensitive(userJSON, "userStatus"); + if (userStatus) { + if(!cJSON_IsNumber(userStatus)) + { + goto end; //Numeric + } + } - user_local_var = user_create( - id ? id->valuedouble : 0, - username ? strdup(username->valuestring) : NULL, - firstName ? strdup(firstName->valuestring) : NULL, - lastName ? strdup(lastName->valuestring) : NULL, - email ? strdup(email->valuestring) : NULL, - password ? strdup(password->valuestring) : NULL, - phone ? strdup(phone->valuestring) : NULL, - userStatus ? userStatus->valuedouble : 0 - ); + user_local_var = user_create ( + id ? id->valuedouble : 0, + username ? strdup(username->valuestring) : NULL, + firstName ? strdup(firstName->valuestring) : NULL, + lastName ? strdup(lastName->valuestring) : NULL, + email ? strdup(email->valuestring) : NULL, + password ? strdup(password->valuestring) : NULL, + phone ? strdup(phone->valuestring) : NULL, + userStatus ? userStatus->valuedouble : 0 + ); - return user_local_var; + return user_local_var; end: - return NULL; + return NULL; + } diff --git a/samples/client/petstore/c/model/user.h b/samples/client/petstore/c/model/user.h index dfb704efb26..954bc64a128 100644 --- a/samples/client/petstore/c/model/user.h +++ b/samples/client/petstore/c/model/user.h @@ -15,18 +15,27 @@ typedef struct user_t { - long id; // numeric - char *username; // string - char *firstName; // string - char *lastName; // string - char *email; // string - char *password; // string - char *phone; // string - int userStatus; // numeric + long id; //numeric + char *username; // string + char *firstName; // string + char *lastName; // string + char *email; // string + char *password; // string + char *phone; // string + int userStatus; //numeric + } user_t; -user_t *user_create(long id, char *username, char *firstName, char *lastName, - char *email, char *password, char *phone, int userStatus); +user_t *user_create( + long id, + char *username, + char *firstName, + char *lastName, + char *email, + char *password, + char *phone, + int userStatus +); void user_free(user_t *user); @@ -35,3 +44,4 @@ user_t *user_parseFromJSON(cJSON *userJSON); cJSON *user_convertToJSON(user_t *user); #endif /* _user_H_ */ + diff --git a/samples/client/petstore/c/src/apiClient.c b/samples/client/petstore/c/src/apiClient.c index eb569bd27a3..492b0563203 100644 --- a/samples/client/petstore/c/src/apiClient.c +++ b/samples/client/petstore/c/src/apiClient.c @@ -10,451 +10,448 @@ size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp); apiClient_t *apiClient_create() { - curl_global_init(CURL_GLOBAL_ALL); - apiClient_t *apiClient = malloc(sizeof(apiClient_t)); - apiClient->basePath = "http://petstore.swagger.io/v2"; - apiClient->dataReceived = NULL; - apiClient->response_code = 0; - apiClient->apiKeys = NULL; - apiClient->accessToken = NULL; + curl_global_init(CURL_GLOBAL_ALL); + apiClient_t *apiClient = malloc(sizeof(apiClient_t)); + apiClient->basePath = "http://petstore.swagger.io/v2"; + apiClient->dataReceived = NULL; + apiClient->response_code = 0; + apiClient->apiKeys = NULL; + apiClient->accessToken = NULL; - return apiClient; + return apiClient; } void apiClient_free(apiClient_t *apiClient) { - if(apiClient->accessToken) { - list_free(apiClient->apiKeys); - } - if(apiClient->accessToken) { - free(apiClient->accessToken); - } - free(apiClient); - curl_global_cleanup(); + if(apiClient->accessToken) { + list_free(apiClient->apiKeys); + } + if(apiClient->accessToken) { + free(apiClient->accessToken); + } + free(apiClient); + curl_global_cleanup(); } void replaceSpaceWithPlus(char *stringToProcess) { - for(int i = 0; i < strlen(stringToProcess); i++) { - if(stringToProcess[i] == ' ') { - stringToProcess[i] = '+'; - } - } + for(int i = 0; i < strlen(stringToProcess); i++) { + if(stringToProcess[i] == ' ') { + stringToProcess[i] = '+'; + } + } } -char *assembleTargetUrl(char *basePath, char *operationParameter, - list_t *queryParameters) { - int neededBufferSizeForQueryParameters = 0; - listEntry_t *listEntry; +char *assembleTargetUrl(char *basePath, + char *operationParameter, + list_t *queryParameters) { + int neededBufferSizeForQueryParameters = 0; + listEntry_t *listEntry; - if(queryParameters != NULL) { - list_ForEach(listEntry, queryParameters) { - keyValuePair_t *pair = listEntry->data; - neededBufferSizeForQueryParameters += - strlen(pair->key) + strlen(pair->value); - } + if(queryParameters != NULL) { + list_ForEach(listEntry, queryParameters) { + keyValuePair_t *pair = listEntry->data; + neededBufferSizeForQueryParameters += + strlen(pair->key) + strlen(pair->value); + } - neededBufferSizeForQueryParameters += - (queryParameters->count * 2); // each keyValuePair is separated by a = and a & except the last, but this makes up for the ? at the beginning - } + neededBufferSizeForQueryParameters += + (queryParameters->count * 2); // each keyValuePair is separated by a = and a & except the last, but this makes up for the ? at the beginning + } - int operationParameterLength = 0; - int basePathLength = strlen(basePath); - bool slashNeedsToBeAppendedToBasePath = false; + int operationParameterLength = 0; + int basePathLength = strlen(basePath); + bool slashNeedsToBeAppendedToBasePath = false; - if(operationParameter != NULL) { - operationParameterLength = (1 + strlen(operationParameter)); - } - if(basePath[strlen(basePath) - 1] != '/') { - slashNeedsToBeAppendedToBasePath = true; - basePathLength++; - } + if(operationParameter != NULL) { + operationParameterLength = (1 + strlen(operationParameter)); + } + if(basePath[strlen(basePath) - 1] != '/') { + slashNeedsToBeAppendedToBasePath = true; + basePathLength++; + } - char *targetUrl = - malloc( - neededBufferSizeForQueryParameters + basePathLength + operationParameterLength + - 1); + char *targetUrl = + malloc( + neededBufferSizeForQueryParameters + basePathLength + operationParameterLength + + 1); - strcpy(targetUrl, basePath); + strcpy(targetUrl, basePath); - if(operationParameter != NULL) { - strcat(targetUrl, operationParameter); - } + if(operationParameter != NULL) { + strcat(targetUrl, operationParameter); + } - if(queryParameters != NULL) { - strcat(targetUrl, "?"); - list_ForEach(listEntry, queryParameters) { - keyValuePair_t *pair = listEntry->data; - replaceSpaceWithPlus(pair->key); - strcat(targetUrl, pair->key); - strcat(targetUrl, "="); - replaceSpaceWithPlus(pair->value); - strcat(targetUrl, pair->value); - if(listEntry->nextListEntry != NULL) { - strcat(targetUrl, "&"); - } - } - } + if(queryParameters != NULL) { + strcat(targetUrl, "?"); + list_ForEach(listEntry, queryParameters) { + keyValuePair_t *pair = listEntry->data; + replaceSpaceWithPlus(pair->key); + strcat(targetUrl, pair->key); + strcat(targetUrl, "="); + replaceSpaceWithPlus(pair->value); + strcat(targetUrl, pair->value); + if(listEntry->nextListEntry != NULL) { + strcat(targetUrl, "&"); + } + } + } - return targetUrl; + return targetUrl; } char *assembleHeaderField(char *key, char *value) { - char *header = malloc(strlen(key) + strlen(value) + 3); + char *header = malloc(strlen(key) + strlen(value) + 3); - strcpy(header, key), - strcat(header, ": "); - strcat(header, value); + strcpy(header, key), + strcat(header, ": "); + strcat(header, value); - return header; + return header; } void postData(CURL *handle, char *bodyParameters) { - curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); - curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, - strlen(bodyParameters)); + curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); + curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, + strlen(bodyParameters)); } int lengthOfKeyPair(keyValuePair_t *keyPair) { - long length = 0; - if((keyPair->key != NULL) && - (keyPair->value != NULL) ) - { - length = strlen(keyPair->key) + strlen(keyPair->value); - return length; - } - return 0; + long length = 0; + if((keyPair->key != NULL) && + (keyPair->value != NULL) ) + { + length = strlen(keyPair->key) + strlen(keyPair->value); + return length; + } + return 0; } -void apiClient_invoke(apiClient_t *apiClient, char *operationParameter, - list_t *queryParameters, list_t *headerParameters, - list_t *formParameters, list_t *headerType, - list_t *contentType, char *bodyParameters, - char *requestType) { - CURL *handle = curl_easy_init(); - CURLcode res; +void apiClient_invoke(apiClient_t *apiClient, + char *operationParameter, + list_t *queryParameters, + list_t *headerParameters, + list_t *formParameters, + list_t *headerType, + list_t *contentType, + char *bodyParameters, + char *requestType) { + CURL *handle = curl_easy_init(); + CURLcode res; - if(handle) { - listEntry_t *listEntry; - curl_mime *mime = NULL; - struct curl_slist *headers = NULL; - char *buffContent = NULL; - char *buffHeader = NULL; - binary_t *fileVar = NULL; - char *formString = NULL; + if(handle) { + listEntry_t *listEntry; + curl_mime *mime = NULL; + struct curl_slist *headers = NULL; + char *buffContent = NULL; + char *buffHeader = NULL; + binary_t *fileVar = NULL; + char *formString = NULL; - if(headerType != NULL) { - list_ForEach(listEntry, headerType) { - if(strstr((char *) listEntry->data, - "xml") == NULL) - { - buffHeader = malloc(strlen( - "Accept: ") + - strlen((char *) - listEntry-> - data) + 1); - sprintf(buffHeader, "%s%s", "Accept: ", - (char *) listEntry->data); - headers = curl_slist_append(headers, - buffHeader); - free(buffHeader); - } - } - } - if(contentType != NULL) { - list_ForEach(listEntry, contentType) { - if(strstr((char *) listEntry->data, - "xml") == NULL) - { - buffContent = - malloc(strlen( - "Content-Type: ") + strlen( - (char *) - listEntry->data) + - 1); - sprintf(buffContent, "%s%s", - "Content-Type: ", - (char *) listEntry->data); - headers = curl_slist_append(headers, - buffContent); - } - } - } else { - headers = curl_slist_append(headers, - "Content-Type: application/json"); - } + if(headerType != NULL) { + list_ForEach(listEntry, headerType) { + if(strstr((char *) listEntry->data, + "xml") == NULL) + { + buffHeader = malloc(strlen( + "Accept: ") + + strlen((char *) + listEntry-> + data) + 1); + sprintf(buffHeader, "%s%s", "Accept: ", + (char *) listEntry->data); + headers = curl_slist_append(headers, + buffHeader); + free(buffHeader); + } + } + } + if(contentType != NULL) { + list_ForEach(listEntry, contentType) { + if(strstr((char *) listEntry->data, + "xml") == NULL) + { + buffContent = + malloc(strlen( + "Content-Type: ") + strlen( + (char *) + listEntry->data) + + 1); + sprintf(buffContent, "%s%s", + "Content-Type: ", + (char *) listEntry->data); + headers = curl_slist_append(headers, + buffContent); + } + } + } else { + headers = curl_slist_append(headers, + "Content-Type: application/json"); + } - if(requestType != NULL) { - curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, - requestType); - } + if(requestType != NULL) { + curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, + requestType); + } - if(formParameters != NULL) { - if(strstr(buffContent, - "application/x-www-form-urlencoded") != NULL) - { - long parameterLength = 0; - long keyPairLength = 0; - list_ForEach(listEntry, formParameters) { - keyValuePair_t *keyPair = - listEntry->data; + if(formParameters != NULL) { + if(strstr(buffContent, + "application/x-www-form-urlencoded") != NULL) + { + long parameterLength = 0; + long keyPairLength = 0; + list_ForEach(listEntry, formParameters) { + keyValuePair_t *keyPair = + listEntry->data; - keyPairLength = - lengthOfKeyPair(keyPair) + 1; + keyPairLength = + lengthOfKeyPair(keyPair) + 1; - if(listEntry->nextListEntry != NULL) { - parameterLength++; - } - parameterLength = parameterLength + - keyPairLength; - } + if(listEntry->nextListEntry != NULL) { + parameterLength++; + } + parameterLength = parameterLength + + keyPairLength; + } - formString = malloc(parameterLength + 1); - memset(formString, 0, parameterLength + 1); + formString = malloc(parameterLength + 1); + memset(formString, 0, parameterLength + 1); - list_ForEach(listEntry, formParameters) { - keyValuePair_t *keyPair = - listEntry->data; - if((keyPair->key != NULL) && - (keyPair->value != NULL) ) - { - strcat(formString, - keyPair->key); - strcat(formString, "="); - strcat(formString, - keyPair->value); - if(listEntry->nextListEntry != - NULL) - { - strcat(formString, "&"); - } - } - } - curl_easy_setopt(handle, CURLOPT_POSTFIELDS, - formString); - } - if(strstr(buffContent, "multipart/form-data") != NULL) { - mime = curl_mime_init(handle); - list_ForEach(listEntry, formParameters) { - keyValuePair_t *keyValuePair = - listEntry->data; + list_ForEach(listEntry, formParameters) { + keyValuePair_t *keyPair = + listEntry->data; + if((keyPair->key != NULL) && + (keyPair->value != NULL) ) + { + strcat(formString, + keyPair->key); + strcat(formString, "="); + strcat(formString, + keyPair->value); + if(listEntry->nextListEntry != + NULL) + { + strcat(formString, "&"); + } + } + } + curl_easy_setopt(handle, CURLOPT_POSTFIELDS, + formString); + } + if(strstr(buffContent, "multipart/form-data") != NULL) { + mime = curl_mime_init(handle); + list_ForEach(listEntry, formParameters) { + keyValuePair_t *keyValuePair = + listEntry->data; - if((keyValuePair->key != NULL) && - (keyValuePair->value != NULL) ) - { - curl_mimepart *part = - curl_mime_addpart(mime); + if((keyValuePair->key != NULL) && + (keyValuePair->value != NULL) ) + { + curl_mimepart *part = + curl_mime_addpart(mime); - curl_mime_name(part, - keyValuePair->key); + curl_mime_name(part, + keyValuePair->key); - if(strcmp(keyValuePair->key, - "file") == 0) - { - memcpy(&fileVar, - keyValuePair->value, - sizeof(fileVar)); - curl_mime_data(part, - fileVar->data, - fileVar->len); - curl_mime_filename(part, - "image.png"); - } else { - curl_mime_data(part, - keyValuePair->value, - CURL_ZERO_TERMINATED); - } - } - } - curl_easy_setopt(handle, CURLOPT_MIMEPOST, - mime); - } - } + if(strcmp(keyValuePair->key, + "file") == 0) + { + memcpy(&fileVar, + keyValuePair->value, + sizeof(fileVar)); + curl_mime_data(part, + fileVar->data, + fileVar->len); + curl_mime_filename(part, + "image.png"); + } else { + curl_mime_data(part, + keyValuePair->value, + CURL_ZERO_TERMINATED); + } + } + } + curl_easy_setopt(handle, CURLOPT_MIMEPOST, + mime); + } + } - list_ForEach(listEntry, headerParameters) { - keyValuePair_t *keyValuePair = listEntry->data; - if((keyValuePair->key != NULL) && - (keyValuePair->value != NULL) ) - { - char *headerValueToWrite = assembleHeaderField( - keyValuePair->key, keyValuePair->value); - curl_slist_append(headers, headerValueToWrite); - free(headerValueToWrite); - } - } - // this would only be generated for apiKey authentication - if(apiClient->apiKeys != NULL) { - list_ForEach(listEntry, apiClient->apiKeys) { - keyValuePair_t *apiKey = listEntry->data; - if((apiKey->key != NULL) && - (apiKey->value != NULL) ) - { - char *headerValueToWrite = - assembleHeaderField( - apiKey->key, - apiKey->value); - curl_slist_append(headers, - headerValueToWrite); - free(headerValueToWrite); - } - } - } + list_ForEach(listEntry, headerParameters) { + keyValuePair_t *keyValuePair = listEntry->data; + if((keyValuePair->key != NULL) && + (keyValuePair->value != NULL) ) + { + char *headerValueToWrite = assembleHeaderField( + keyValuePair->key, keyValuePair->value); + curl_slist_append(headers, headerValueToWrite); + free(headerValueToWrite); + } + } + // this would only be generated for apiKey authentication + if (apiClient->apiKeys != NULL) + { + list_ForEach(listEntry, apiClient->apiKeys) { + keyValuePair_t *apiKey = listEntry->data; + if((apiKey->key != NULL) && + (apiKey->value != NULL) ) + { + char *headerValueToWrite = assembleHeaderField( + apiKey->key, apiKey->value); + curl_slist_append(headers, headerValueToWrite); + free(headerValueToWrite); + } + } + } - char *targetUrl = - assembleTargetUrl(apiClient->basePath, - operationParameter, - queryParameters); + char *targetUrl = + assembleTargetUrl(apiClient->basePath, + operationParameter, + queryParameters); - curl_easy_setopt(handle, CURLOPT_URL, targetUrl); - curl_easy_setopt(handle, - CURLOPT_WRITEFUNCTION, - writeDataCallback); - curl_easy_setopt(handle, - CURLOPT_WRITEDATA, - &apiClient->dataReceived); - curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); - curl_easy_setopt(handle, CURLOPT_VERBOSE, 0); // to get curl debug msg 0: to disable, 1L:to enable + curl_easy_setopt(handle, CURLOPT_URL, targetUrl); + curl_easy_setopt(handle, + CURLOPT_WRITEFUNCTION, + writeDataCallback); + curl_easy_setopt(handle, + CURLOPT_WRITEDATA, + &apiClient->dataReceived); + curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); + curl_easy_setopt(handle, CURLOPT_VERBOSE, 0); // to get curl debug msg 0: to disable, 1L:to enable - // this would only be generated for OAuth2 authentication - if(apiClient->accessToken != NULL) { - // curl_easy_setopt(handle, CURLOPT_HTTPAUTH, CURLAUTH_BEARER); - curl_easy_setopt(handle, - CURLOPT_XOAUTH2_BEARER, - apiClient->accessToken); - } + // this would only be generated for OAuth2 authentication + if(apiClient->accessToken != NULL) { + // curl_easy_setopt(handle, CURLOPT_HTTPAUTH, CURLAUTH_BEARER); + curl_easy_setopt(handle, + CURLOPT_XOAUTH2_BEARER, + apiClient->accessToken); + } - if(bodyParameters != NULL) { - postData(handle, bodyParameters); - } + if(bodyParameters != NULL) { + postData(handle, bodyParameters); + } - res = curl_easy_perform(handle); + res = curl_easy_perform(handle); - curl_slist_free_all(headers); + curl_slist_free_all(headers); - free(targetUrl); + free(targetUrl); - if(contentType != NULL) { - free(buffContent); - } + if(contentType != NULL) { + free(buffContent); + } - if(res == CURLE_OK) { - curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, - &apiClient->response_code); - } else { - char *url, *ip, *scheme; - long port; - curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &url); - curl_easy_getinfo(handle, CURLINFO_PRIMARY_IP, &ip); - curl_easy_getinfo(handle, CURLINFO_PRIMARY_PORT, &port); - curl_easy_getinfo(handle, CURLINFO_SCHEME, &scheme); - fprintf(stderr, - "curl_easy_perform() failed\n\nURL: %s\nIP: %s\nPORT: %li\nSCHEME: %s\nStrERROR: %s\n", url, ip, port, scheme, - curl_easy_strerror(res)); - } + if(res == CURLE_OK) { + curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &apiClient->response_code); + } else { + char *url,*ip,*scheme; + long port; + curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &url); + curl_easy_getinfo(handle, CURLINFO_PRIMARY_IP, &ip); + curl_easy_getinfo(handle, CURLINFO_PRIMARY_PORT, &port); + curl_easy_getinfo(handle, CURLINFO_SCHEME, &scheme); + fprintf(stderr, "curl_easy_perform() failed\n\nURL: %s\nIP: %s\nPORT: %li\nSCHEME: %s\nStrERROR: %s\n",url,ip,port,scheme, + curl_easy_strerror(res)); + } - curl_easy_cleanup(handle); - if(formParameters != NULL) { - free(formString); - curl_mime_free(mime); - } - } + curl_easy_cleanup(handle); + if(formParameters != NULL) { + free(formString); + curl_mime_free(mime); + } + } } size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) { - *(char **) userp = strdup(buffer); + *(char **) userp = strdup(buffer); - return size * nmemb; + return size * nmemb; } char *strReplace(char *orig, char *rep, char *with) { - char *result; // the return string - char *ins; // the next insert point - char *tmp; // varies - int lenRep; // length of rep (the string to remove) - int lenWith; // length of with (the string to replace rep with) - int lenFront; // distance between rep and end of last rep - int count; // number of replacements + char *result; // the return string + char *ins; // the next insert point + char *tmp; // varies + int lenRep; // length of rep (the string to remove) + int lenWith; // length of with (the string to replace rep with) + int lenFront; // distance between rep and end of last rep + int count; // number of replacements - // sanity checks and initialization - if(!orig || - !rep) - { - return NULL; - } - lenRep = strlen(rep); - if(lenRep == 0) { - return NULL; // empty rep causes infinite loop during count - } - if(!with) { - with = ""; - } - lenWith = strlen(with); + // sanity checks and initialization + if(!orig || !rep) + { + return NULL; + } + lenRep = strlen(rep); + if(lenRep == 0) { + return NULL; // empty rep causes infinite loop during count + } + if(!with) { + with = ""; + } + lenWith = strlen(with); - // count the number of replacements needed - ins = orig; - for(count = 0; tmp = strstr(ins, rep); ++count) { - ins = tmp + lenRep; - } + // count the number of replacements needed + ins = orig; + for(count = 0; tmp = strstr(ins, rep); ++count) { + ins = tmp + lenRep; + } - tmp = result = malloc(strlen(orig) + (lenWith - lenRep) * count + 1); + tmp = result = malloc(strlen(orig) + (lenWith - lenRep) * count + 1); - if(!result) { - return NULL; - } - char *originalPointer = orig; // copying original pointer to free the memory - // first time through the loop, all the variable are set correctly - // from here on, - // tmp points to the end of the result string - // ins points to the next occurrence of rep in orig - // orig points to the remainder of orig after "end of rep" - while(count--) { - ins = strstr(orig, rep); - lenFront = ins - orig; - tmp = strncpy(tmp, orig, lenFront) + lenFront; - tmp = strcpy(tmp, with) + lenWith; - orig += lenFront + lenRep; // move to next "end of rep" - } - strcpy(tmp, orig); - free(originalPointer); - return result; + if(!result) { + return NULL; + } + char *originalPointer = orig; // copying original pointer to free the memory + // first time through the loop, all the variable are set correctly + // from here on, + // tmp points to the end of the result string + // ins points to the next occurrence of rep in orig + // orig points to the remainder of orig after "end of rep" + while(count--) { + ins = strstr(orig, rep); + lenFront = ins - orig; + tmp = strncpy(tmp, orig, lenFront) + lenFront; + tmp = strcpy(tmp, with) + lenWith; + orig += lenFront + lenRep; // move to next "end of rep" + } + strcpy(tmp, orig); + free(originalPointer); + return result; } -char *sbi_base64encode(const void *b64_encode_this, - int encode_this_many_bytes) { +char *sbi_base64encode (const void *b64_encode_this, int encode_this_many_bytes){ #ifdef OPENSSL - BIO *b64_bio, *mem_bio; // Declares two OpenSSL BIOs: a base64 filter and a memory BIO. - BUF_MEM *mem_bio_mem_ptr; // Pointer to a "memory BIO" structure holding our base64 data. - b64_bio = BIO_new(BIO_f_base64()); // Initialize our base64 filter BIO. - mem_bio = BIO_new(BIO_s_mem()); // Initialize our memory sink BIO. - BIO_push(b64_bio, mem_bio); // Link the BIOs by creating a filter-sink BIO chain. - BIO_set_flags(b64_bio, BIO_FLAGS_BASE64_NO_NL); // No newlines every 64 characters or less. - BIO_write(b64_bio, b64_encode_this, encode_this_many_bytes); // Records base64 encoded data. - BIO_flush(b64_bio); // Flush data. Necessary for b64 encoding, because of pad characters. - BIO_get_mem_ptr(mem_bio, &mem_bio_mem_ptr); // Store address of mem_bio's memory structure. - BIO_set_close(mem_bio, BIO_NOCLOSE); // Permit access to mem_ptr after BIOs are destroyed. - BIO_free_all(b64_bio); // Destroys all BIOs in chain, starting with b64 (i.e. the 1st one). - BUF_MEM_grow(mem_bio_mem_ptr, (*mem_bio_mem_ptr).length + 1); // Makes space for end null. - (*mem_bio_mem_ptr).data[(*mem_bio_mem_ptr).length] = '\0'; // Adds null-terminator to tail. - return (*mem_bio_mem_ptr).data; // Returns base-64 encoded data. (See: "buf_mem_st" struct). + BIO *b64_bio, *mem_bio; //Declares two OpenSSL BIOs: a base64 filter and a memory BIO. + BUF_MEM *mem_bio_mem_ptr; //Pointer to a "memory BIO" structure holding our base64 data. + b64_bio = BIO_new(BIO_f_base64()); //Initialize our base64 filter BIO. + mem_bio = BIO_new(BIO_s_mem()); //Initialize our memory sink BIO. + BIO_push(b64_bio, mem_bio); //Link the BIOs by creating a filter-sink BIO chain. + BIO_set_flags(b64_bio, BIO_FLAGS_BASE64_NO_NL); //No newlines every 64 characters or less. + BIO_write(b64_bio, b64_encode_this, encode_this_many_bytes); //Records base64 encoded data. + BIO_flush(b64_bio); //Flush data. Necessary for b64 encoding, because of pad characters. + BIO_get_mem_ptr(mem_bio, &mem_bio_mem_ptr); //Store address of mem_bio's memory structure. + BIO_set_close(mem_bio, BIO_NOCLOSE); //Permit access to mem_ptr after BIOs are destroyed. + BIO_free_all(b64_bio); //Destroys all BIOs in chain, starting with b64 (i.e. the 1st one). + BUF_MEM_grow(mem_bio_mem_ptr, (*mem_bio_mem_ptr).length + 1); //Makes space for end null. + (*mem_bio_mem_ptr).data[(*mem_bio_mem_ptr).length] = '\0'; //Adds null-terminator to tail. + return (*mem_bio_mem_ptr).data; //Returns base-64 encoded data. (See: "buf_mem_st" struct). #endif } -char *sbi_base64decode(const void *b64_decode_this, - int decode_this_many_bytes) { +char *sbi_base64decode (const void *b64_decode_this, int decode_this_many_bytes){ #ifdef OPENSSL - BIO *b64_bio, *mem_bio; // Declares two OpenSSL BIOs: a base64 filter and a memory BIO. - char *base64_decoded = calloc( (decode_this_many_bytes * 3) / 4 + 1, - sizeof(char) ); // +1 = null. - b64_bio = BIO_new(BIO_f_base64()); // Initialize our base64 filter BIO. - mem_bio = BIO_new(BIO_s_mem()); // Initialize our memory source BIO. - BIO_write(mem_bio, b64_decode_this, decode_this_many_bytes); // Base64 data saved in source. - BIO_push(b64_bio, mem_bio); // Link the BIOs by creating a filter-source BIO chain. - BIO_set_flags(b64_bio, BIO_FLAGS_BASE64_NO_NL); // Don't require trailing newlines. - int decoded_byte_index = 0; // Index where the next base64_decoded byte should be written. - while(0 < BIO_read(b64_bio, base64_decoded + decoded_byte_index, 1) ) { // Read byte-by-byte. - decoded_byte_index++; // Increment the index until read of BIO decoded data is complete. - } // Once we're done reading decoded data, BIO_read returns -1 even though there's no error. - BIO_free_all(b64_bio); // Destroys all BIOs in chain, starting with b64 (i.e. the 1st one). - return base64_decoded; // Returns base-64 decoded data with trailing null terminator. + BIO *b64_bio, *mem_bio; //Declares two OpenSSL BIOs: a base64 filter and a memory BIO. + char *base64_decoded = calloc( (decode_this_many_bytes*3)/4+1, sizeof(char) ); //+1 = null. + b64_bio = BIO_new(BIO_f_base64()); //Initialize our base64 filter BIO. + mem_bio = BIO_new(BIO_s_mem()); //Initialize our memory source BIO. + BIO_write(mem_bio, b64_decode_this, decode_this_many_bytes); //Base64 data saved in source. + BIO_push(b64_bio, mem_bio); //Link the BIOs by creating a filter-source BIO chain. + BIO_set_flags(b64_bio, BIO_FLAGS_BASE64_NO_NL); //Don't require trailing newlines. + int decoded_byte_index = 0; //Index where the next base64_decoded byte should be written. + while ( 0 < BIO_read(b64_bio, base64_decoded+decoded_byte_index, 1) ){ //Read byte-by-byte. + decoded_byte_index++; //Increment the index until read of BIO decoded data is complete. + } //Once we're done reading decoded data, BIO_read returns -1 even though there's no error. + BIO_free_all(b64_bio); //Destroys all BIOs in chain, starting with b64 (i.e. the 1st one). + return base64_decoded; //Returns base-64 decoded data with trailing null terminator. #endif } diff --git a/samples/client/petstore/c/src/apiKey.c b/samples/client/petstore/c/src/apiKey.c index a7e000eb3b1..2bf8fc3e9d0 100644 --- a/samples/client/petstore/c/src/apiKey.c +++ b/samples/client/petstore/c/src/apiKey.c @@ -3,12 +3,12 @@ #include "../include/keyValuePair.h" keyValuePair_t *keyValuePair_create(char *key, void *value) { - keyValuePair_t *keyValuePair = malloc(sizeof(keyValuePair_t)); - keyValuePair->key = key; - keyValuePair->value = value; - return keyValuePair; + keyValuePair_t *keyValuePair = malloc(sizeof(keyValuePair_t)); + keyValuePair->key = key; + keyValuePair->value = value; + return keyValuePair; } void keyValuePair_free(keyValuePair_t *keyValuePair) { - free(keyValuePair); + free(keyValuePair); } diff --git a/samples/client/petstore/c/src/list.c b/samples/client/petstore/c/src/list.c index dc3f78dab76..73eee13c24d 100644 --- a/samples/client/petstore/c/src/list.c +++ b/samples/client/petstore/c/src/list.c @@ -4,161 +4,163 @@ #include "../include/list.h" static listEntry_t *listEntry_create(void *data) { - listEntry_t *createdListEntry = malloc(sizeof(listEntry_t)); - if(createdListEntry == NULL) { - // TODO Malloc Failure - return NULL; - } - createdListEntry->data = data; + listEntry_t *createdListEntry = malloc(sizeof(listEntry_t)); + if(createdListEntry == NULL) { + // TODO Malloc Failure + return NULL; + } + createdListEntry->data = data; - return createdListEntry; + return createdListEntry; } void listEntry_free(listEntry_t *listEntry, void *additionalData) { - free(listEntry); + free(listEntry); } void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) { - printf("%i\n", *((int *) (listEntry->data))); + printf("%i\n", *((int *) (listEntry->data))); } list_t *list_create() { - list_t *createdList = malloc(sizeof(list_t)); - if(createdList == NULL) { - // TODO Malloc Failure - return NULL; - } - createdList->firstEntry = NULL; - createdList->lastEntry = NULL; - createdList->count = 0; + list_t *createdList = malloc(sizeof(list_t)); + if(createdList == NULL) { + // TODO Malloc Failure + return NULL; + } + createdList->firstEntry = NULL; + createdList->lastEntry = NULL; + createdList->count = 0; - return createdList; + return createdList; } -void list_iterateThroughListForward(list_t *list, void (*operationToPerform)( - listEntry_t *, - void *callbackFunctionUsedData), +void list_iterateThroughListForward(list_t *list, + void (*operationToPerform)( + listEntry_t *, + void *callbackFunctionUsedData), void *additionalDataNeededForCallbackFunction) { - listEntry_t *currentListEntry = list->firstEntry; - listEntry_t *nextListEntry; + listEntry_t *currentListEntry = list->firstEntry; + listEntry_t *nextListEntry; - if(currentListEntry == NULL) { - return; - } + if(currentListEntry == NULL) { + return; + } - nextListEntry = currentListEntry->nextListEntry; + nextListEntry = currentListEntry->nextListEntry; - operationToPerform(currentListEntry, - additionalDataNeededForCallbackFunction); - currentListEntry = nextListEntry; + operationToPerform(currentListEntry, + additionalDataNeededForCallbackFunction); + currentListEntry = nextListEntry; - while(currentListEntry != NULL) { - nextListEntry = currentListEntry->nextListEntry; - operationToPerform(currentListEntry, - additionalDataNeededForCallbackFunction); - currentListEntry = nextListEntry; - } + while(currentListEntry != NULL) { + nextListEntry = currentListEntry->nextListEntry; + operationToPerform(currentListEntry, + additionalDataNeededForCallbackFunction); + currentListEntry = nextListEntry; + } } -void list_iterateThroughListBackward(list_t *list, void (*operationToPerform)( - listEntry_t *, - void *callbackFunctionUsedData), +void list_iterateThroughListBackward(list_t *list, + void (*operationToPerform)( + listEntry_t *, + void *callbackFunctionUsedData), void *additionalDataNeededForCallbackFunction) { - listEntry_t *currentListEntry = list->lastEntry; - listEntry_t *nextListEntry = currentListEntry->prevListEntry; + listEntry_t *currentListEntry = list->lastEntry; + listEntry_t *nextListEntry = currentListEntry->prevListEntry; - if(currentListEntry == NULL) { - return; - } + if(currentListEntry == NULL) { + return; + } - operationToPerform(currentListEntry, - additionalDataNeededForCallbackFunction); - currentListEntry = nextListEntry; + operationToPerform(currentListEntry, + additionalDataNeededForCallbackFunction); + currentListEntry = nextListEntry; - while(currentListEntry != NULL) { - nextListEntry = currentListEntry->prevListEntry; - operationToPerform(currentListEntry, - additionalDataNeededForCallbackFunction); - currentListEntry = nextListEntry; - } + while(currentListEntry != NULL) { + nextListEntry = currentListEntry->prevListEntry; + operationToPerform(currentListEntry, + additionalDataNeededForCallbackFunction); + currentListEntry = nextListEntry; + } } void list_free(list_t *list) { - list_iterateThroughListForward(list, listEntry_free, NULL); - free(list); + list_iterateThroughListForward(list, listEntry_free, NULL); + free(list); } void list_addElement(list_t *list, void *dataToAddInList) { - listEntry_t *newListEntry = listEntry_create(dataToAddInList); - if(newListEntry == NULL) { - // TODO Malloc Failure - return; - } - if(list->firstEntry == NULL) { - list->firstEntry = newListEntry; - list->lastEntry = newListEntry; + listEntry_t *newListEntry = listEntry_create(dataToAddInList); + if(newListEntry == NULL) { + // TODO Malloc Failure + return; + } + if(list->firstEntry == NULL) { + list->firstEntry = newListEntry; + list->lastEntry = newListEntry; - newListEntry->prevListEntry = NULL; - newListEntry->nextListEntry = NULL; + newListEntry->prevListEntry = NULL; + newListEntry->nextListEntry = NULL; - list->count++; + list->count++; - return; - } + return; + } - list->lastEntry->nextListEntry = newListEntry; - newListEntry->prevListEntry = list->lastEntry; - newListEntry->nextListEntry = NULL; - list->lastEntry = newListEntry; + list->lastEntry->nextListEntry = newListEntry; + newListEntry->prevListEntry = list->lastEntry; + newListEntry->nextListEntry = NULL; + list->lastEntry = newListEntry; - list->count++; + list->count++; } void list_removeElement(list_t *list, listEntry_t *elementToRemove) { - listEntry_t *elementBeforeElementToRemove = - elementToRemove->prevListEntry; - listEntry_t *elementAfterElementToRemove = - elementToRemove->nextListEntry; + listEntry_t *elementBeforeElementToRemove = + elementToRemove->prevListEntry; + listEntry_t *elementAfterElementToRemove = + elementToRemove->nextListEntry; - if(elementBeforeElementToRemove != NULL) { - elementBeforeElementToRemove->nextListEntry = - elementAfterElementToRemove; - } else { - list->firstEntry = elementAfterElementToRemove; - } + if(elementBeforeElementToRemove != NULL) { + elementBeforeElementToRemove->nextListEntry = + elementAfterElementToRemove; + } else { + list->firstEntry = elementAfterElementToRemove; + } - if(elementAfterElementToRemove != NULL) { - elementAfterElementToRemove->prevListEntry = - elementBeforeElementToRemove; - } else { - list->lastEntry = elementBeforeElementToRemove; - } + if(elementAfterElementToRemove != NULL) { + elementAfterElementToRemove->prevListEntry = + elementBeforeElementToRemove; + } else { + list->lastEntry = elementBeforeElementToRemove; + } - listEntry_free(elementToRemove, NULL); + listEntry_free(elementToRemove, NULL); - list->count--; + list->count--; } listEntry_t *list_getElementAt(list_t *list, long indexOfElement) { - listEntry_t *currentListEntry; + listEntry_t *currentListEntry; - if((list->count / 2) > indexOfElement) { - currentListEntry = list->firstEntry; + if((list->count / 2) > indexOfElement) { + currentListEntry = list->firstEntry; - for(int i = 0; i < indexOfElement; i++) { - currentListEntry = currentListEntry->nextListEntry; - } + for(int i = 0; i < indexOfElement; i++) { + currentListEntry = currentListEntry->nextListEntry; + } - return currentListEntry; - } else { - currentListEntry = list->lastEntry; + return currentListEntry; + } else { + currentListEntry = list->lastEntry; - for(int i = 1; i < (list->count - indexOfElement); i++) { - currentListEntry = currentListEntry->prevListEntry; - } + for(int i = 1; i < (list->count - indexOfElement); i++) { + currentListEntry = currentListEntry->prevListEntry; + } - return currentListEntry; - } + return currentListEntry; + } } diff --git a/samples/client/petstore/cpp-qt5/.clang-format b/samples/client/petstore/cpp-qt5/.clang-format new file mode 100644 index 00000000000..1afa04682fa --- /dev/null +++ b/samples/client/petstore/cpp-qt5/.clang-format @@ -0,0 +1,7 @@ +--- +Language: Cpp +AccessModifierOffset: -4 +AllowShortFunctionsOnASingleLine: Empty +BreakBeforeBinaryOperators: NonAssignment +ColumnLimit: 0 +IndentWidth: 4 diff --git a/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp index da684cfc7f5..595aa66b3cd 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp +++ b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp @@ -19,7 +19,7 @@ void PetApiTests::findPetsByStatusTest() { connect(&api, &PFXPetApi::findPetsByStatusSignal, [&](QList pets) { petFound = true; - foreach(PFXPet pet, pets) { + foreach (PFXPet pet, pets) { QVERIFY(pet.getStatus().startsWith("available") || pet.getStatus().startsWith("sold")); } loop.quit(); @@ -74,7 +74,7 @@ void PetApiTests::updatePetTest() { QEventLoop loop; bool petAdded = false; - connect(&api, &PFXPetApi::addPetSignal, [&](){ + connect(&api, &PFXPetApi::addPetSignal, [&]() { petAdded = true; loop.quit(); }); @@ -89,9 +89,9 @@ void PetApiTests::updatePetTest() { bool petFetched = false; connect(&api, &PFXPetApi::getPetByIdSignal, this, [&](PFXPet pet) { - petFetched = true; - petToCheck = pet; - loop.quit(); + petFetched = true; + petToCheck = pet; + loop.quit(); }); // create pet @@ -138,7 +138,7 @@ void PetApiTests::updatePetWithFormTest() { // create pet bool petAdded = false; - connect(&api, &PFXPetApi::addPetSignal, [&](){ + connect(&api, &PFXPetApi::addPetSignal, [&]() { petAdded = true; loop.quit(); }); @@ -163,7 +163,7 @@ void PetApiTests::updatePetWithFormTest() { // update it bool petUpdated = false; - connect(&api, &PFXPetApi::updatePetWithFormSignal, [&](){ + connect(&api, &PFXPetApi::updatePetWithFormSignal, [&]() { petUpdated = true; loop.quit(); }); diff --git a/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h index ec126905cf5..98989c51d25 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h +++ b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h @@ -4,7 +4,7 @@ using namespace test_namespace; -class PetApiTests: public QObject { +class PetApiTests : public QObject { Q_OBJECT PFXPet createRandomPet(); diff --git a/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.cpp b/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.cpp index 282d40cac10..fd7d04b0ba4 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.cpp +++ b/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.cpp @@ -1,8 +1,8 @@ #include "StoreApiTests.h" +#include #include #include -#include void StoreApiTests::placeOrderTest() { PFXStoreApi api; @@ -16,7 +16,7 @@ void StoreApiTests::placeOrderTest() { qDebug() << order.getShipDate(); loop.quit(); }); - connect(&api, &PFXStoreApi::placeOrderSignalE, [&](){ + connect(&api, &PFXStoreApi::placeOrderSignalE, [&]() { QFAIL("shouldn't trigger error"); loop.quit(); }); @@ -60,7 +60,7 @@ void StoreApiTests::getInventoryTest() { connect(&api, &PFXStoreApi::getInventorySignal, [&](QMap status) { inventoryFetched = true; - for(const auto& key : status.keys()) { + for (const auto &key : status.keys()) { qDebug() << (key) << " Quantities " << status.value(key); } loop.quit(); diff --git a/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.h b/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.h index 440bf181c54..f2c9391afcb 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.h +++ b/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.h @@ -4,7 +4,7 @@ using namespace test_namespace; -class StoreApiTests: public QObject { +class StoreApiTests : public QObject { Q_OBJECT private slots: diff --git a/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.cpp b/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.cpp index c047724372a..87e7c3f591b 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.cpp +++ b/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.cpp @@ -1,8 +1,8 @@ #include "UserApiTests.h" +#include #include #include -#include PFXUser UserApiTests::createRandomUser() { PFXUser user; @@ -17,14 +17,14 @@ PFXUser UserApiTests::createRandomUser() { return user; } -void UserApiTests::createUserTest(){ +void UserApiTests::createUserTest() { PFXUserApi api; QEventLoop loop; bool userCreated = false; - connect(&api, &PFXUserApi::createUserSignal, [&](){ - userCreated = true; - loop.quit(); + connect(&api, &PFXUserApi::createUserSignal, [&]() { + userCreated = true; + loop.quit(); }); api.createUser(createRandomUser()); @@ -33,14 +33,14 @@ void UserApiTests::createUserTest(){ QVERIFY2(userCreated, "didn't finish within timeout"); } -void UserApiTests::createUsersWithArrayInputTest(){ +void UserApiTests::createUsersWithArrayInputTest() { PFXUserApi api; QEventLoop loop; bool usersCreated = false; - connect(&api, &PFXUserApi::createUsersWithArrayInputSignal, [&](){ - usersCreated = true; - loop.quit(); + connect(&api, &PFXUserApi::createUsersWithArrayInputSignal, [&]() { + usersCreated = true; + loop.quit(); }); QList users; @@ -53,14 +53,14 @@ void UserApiTests::createUsersWithArrayInputTest(){ QVERIFY2(usersCreated, "didn't finish within timeout"); } -void UserApiTests::createUsersWithListInputTest(){ +void UserApiTests::createUsersWithListInputTest() { PFXUserApi api; QEventLoop loop; bool usersCreated = false; - connect(&api, &PFXUserApi::createUsersWithListInputSignal, [&](){ - usersCreated = true; - loop.quit(); + connect(&api, &PFXUserApi::createUsersWithListInputSignal, [&]() { + usersCreated = true; + loop.quit(); }); QList users; @@ -77,14 +77,14 @@ void UserApiTests::createUsersWithListInputTest(){ QVERIFY2(usersCreated, "didn't finish within timeout"); } -void UserApiTests::deleteUserTest(){ +void UserApiTests::deleteUserTest() { PFXUserApi api; QEventLoop loop; bool userDeleted = false; - connect(&api, &PFXUserApi::deleteUserSignal, [&](){ - userDeleted = true; - loop.quit(); + connect(&api, &PFXUserApi::deleteUserSignal, [&]() { + userDeleted = true; + loop.quit(); }); api.deleteUser("rambo"); @@ -93,7 +93,7 @@ void UserApiTests::deleteUserTest(){ QVERIFY2(userDeleted, "didn't finish within timeout"); } -void UserApiTests::getUserByNameTest(){ +void UserApiTests::getUserByNameTest() { PFXUserApi api; QEventLoop loop; bool userFetched = false; @@ -111,7 +111,7 @@ void UserApiTests::getUserByNameTest(){ QVERIFY2(userFetched, "didn't finish within timeout"); } -void UserApiTests::loginUserTest(){ +void UserApiTests::loginUserTest() { PFXUserApi api; QEventLoop loop; bool userLogged = false; @@ -128,12 +128,12 @@ void UserApiTests::loginUserTest(){ QVERIFY2(userLogged, "didn't finish within timeout"); } -void UserApiTests::logoutUserTest(){ +void UserApiTests::logoutUserTest() { PFXUserApi api; QEventLoop loop; bool userLoggedOut = false; - connect(&api, &PFXUserApi::logoutUserSignal, [&](){ + connect(&api, &PFXUserApi::logoutUserSignal, [&]() { userLoggedOut = true; loop.quit(); }); @@ -144,14 +144,14 @@ void UserApiTests::logoutUserTest(){ QVERIFY2(userLoggedOut, "didn't finish within timeout"); } -void UserApiTests::updateUserTest(){ +void UserApiTests::updateUserTest() { PFXUserApi api; QEventLoop loop; bool userUpdated = false; connect(&api, &PFXUserApi::updateUserSignal, [&]() { - userUpdated = true; - loop.quit(); + userUpdated = true; + loop.quit(); }); auto johndoe = createRandomUser(); diff --git a/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.h b/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.h index 3cfd25bd8fe..8917d6a7c0c 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.h +++ b/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.h @@ -4,7 +4,7 @@ using namespace test_namespace; -class UserApiTests: public QObject { +class UserApiTests : public QObject { Q_OBJECT PFXUser createRandomUser(); diff --git a/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp index 81438054c73..48145317854 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp @@ -3,20 +3,18 @@ * 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 "PFXApiResponse.h" -#include -#include -#include #include +#include +#include +#include #include "PFXHelpers.h" @@ -31,120 +29,108 @@ PFXApiResponse::PFXApiResponse() { this->initializeModel(); } -PFXApiResponse::~PFXApiResponse() { +PFXApiResponse::~PFXApiResponse() {} -} +void PFXApiResponse::initializeModel() { -void -PFXApiResponse::initializeModel() { - m_code_isSet = false; m_code_isValid = false; - + m_type_isSet = false; m_type_isValid = false; - + m_message_isSet = false; m_message_isValid = false; - } -void -PFXApiResponse::fromJson(QString jsonString) { - QByteArray array (jsonString.toStdString().c_str()); +void PFXApiResponse::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } -void -PFXApiResponse::fromJsonObject(QJsonObject json) { - +void PFXApiResponse::fromJsonObject(QJsonObject json) { + m_code_isValid = ::test_namespace::fromJsonValue(code, json[QString("code")]); m_code_isSet = !json[QString("code")].isNull() && m_code_isValid; - + m_type_isValid = ::test_namespace::fromJsonValue(type, json[QString("type")]); m_type_isSet = !json[QString("type")].isNull() && m_type_isValid; - + m_message_isValid = ::test_namespace::fromJsonValue(message, json[QString("message")]); m_message_isSet = !json[QString("message")].isNull() && m_message_isValid; - } -QString -PFXApiResponse::asJson () const { +QString PFXApiResponse::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } -QJsonObject -PFXApiResponse::asJsonObject() const { +QJsonObject PFXApiResponse::asJsonObject() const { QJsonObject obj; - if(m_code_isSet){ + if (m_code_isSet) { obj.insert(QString("code"), ::test_namespace::toJsonValue(code)); } - if(m_type_isSet){ + if (m_type_isSet) { obj.insert(QString("type"), ::test_namespace::toJsonValue(type)); } - if(m_message_isSet){ + if (m_message_isSet) { obj.insert(QString("message"), ::test_namespace::toJsonValue(message)); } return obj; } - -qint32 -PFXApiResponse::getCode() const { +qint32 PFXApiResponse::getCode() const { return code; } -void -PFXApiResponse::setCode(const qint32 &code) { +void PFXApiResponse::setCode(const qint32 &code) { this->code = code; this->m_code_isSet = true; } - -QString -PFXApiResponse::getType() const { +QString PFXApiResponse::getType() const { return type; } -void -PFXApiResponse::setType(const QString &type) { +void PFXApiResponse::setType(const QString &type) { this->type = type; this->m_type_isSet = true; } - -QString -PFXApiResponse::getMessage() const { +QString PFXApiResponse::getMessage() const { return message; } -void -PFXApiResponse::setMessage(const QString &message) { +void PFXApiResponse::setMessage(const QString &message) { this->message = message; this->m_message_isSet = true; } -bool -PFXApiResponse::isSet() const { +bool PFXApiResponse::isSet() const { bool isObjectUpdated = false; - do{ - if(m_code_isSet){ isObjectUpdated = true; break;} - - if(m_type_isSet){ isObjectUpdated = true; break;} - - if(m_message_isSet){ isObjectUpdated = true; break;} - }while(false); + do { + if (m_code_isSet) { + isObjectUpdated = true; + break; + } + + if (m_type_isSet) { + isObjectUpdated = true; + break; + } + + if (m_message_isSet) { + isObjectUpdated = true; + break; + } + } while (false); return isObjectUpdated; } -bool -PFXApiResponse::isValid() const { +bool PFXApiResponse::isValid() const { // only required properties are required for the object to be considered valid return true; } -} - +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h index 77f5765b2a8..9729da2e07b 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h +++ b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h @@ -3,7 +3,6 @@ * 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 @@ -21,61 +20,53 @@ #include - #include -#include "PFXObject.h" #include "PFXEnum.h" - +#include "PFXObject.h" namespace test_namespace { -class PFXApiResponse: public PFXObject { +class PFXApiResponse : public PFXObject { public: PFXApiResponse(); PFXApiResponse(QString json); ~PFXApiResponse() override; - QString asJson () const override; + QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; - qint32 getCode() const; void setCode(const qint32 &code); - QString getType() const; void setType(const QString &type); - QString getMessage() const; void setMessage(const QString &message); - - virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); - + qint32 code; bool m_code_isSet; bool m_code_isValid; - + QString type; bool m_type_isSet; bool m_type_isValid; - + QString message; bool m_message_isSet; bool m_message_isValid; - - }; +}; -} +} // namespace test_namespace Q_DECLARE_METATYPE(test_namespace::PFXApiResponse) diff --git a/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp b/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp index 5b1404cd7dc..887d11c73e8 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp @@ -3,20 +3,18 @@ * 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 "PFXCategory.h" -#include -#include -#include #include +#include +#include +#include #include "PFXHelpers.h" @@ -31,98 +29,86 @@ PFXCategory::PFXCategory() { this->initializeModel(); } -PFXCategory::~PFXCategory() { +PFXCategory::~PFXCategory() {} -} +void PFXCategory::initializeModel() { -void -PFXCategory::initializeModel() { - m_id_isSet = false; m_id_isValid = false; - + m_name_isSet = false; m_name_isValid = false; - } -void -PFXCategory::fromJson(QString jsonString) { - QByteArray array (jsonString.toStdString().c_str()); +void PFXCategory::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } -void -PFXCategory::fromJsonObject(QJsonObject json) { - +void PFXCategory::fromJsonObject(QJsonObject json) { + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - + m_name_isValid = ::test_namespace::fromJsonValue(name, json[QString("name")]); m_name_isSet = !json[QString("name")].isNull() && m_name_isValid; - } -QString -PFXCategory::asJson () const { +QString PFXCategory::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } -QJsonObject -PFXCategory::asJsonObject() const { +QJsonObject PFXCategory::asJsonObject() const { QJsonObject obj; - if(m_id_isSet){ + if (m_id_isSet) { obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } - if(m_name_isSet){ + if (m_name_isSet) { obj.insert(QString("name"), ::test_namespace::toJsonValue(name)); } return obj; } - -qint64 -PFXCategory::getId() const { +qint64 PFXCategory::getId() const { return id; } -void -PFXCategory::setId(const qint64 &id) { +void PFXCategory::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } - -QString -PFXCategory::getName() const { +QString PFXCategory::getName() const { return name; } -void -PFXCategory::setName(const QString &name) { +void PFXCategory::setName(const QString &name) { this->name = name; this->m_name_isSet = true; } -bool -PFXCategory::isSet() const { +bool PFXCategory::isSet() const { bool isObjectUpdated = false; - do{ - if(m_id_isSet){ isObjectUpdated = true; break;} - - if(m_name_isSet){ isObjectUpdated = true; break;} - }while(false); + do { + if (m_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_name_isSet) { + isObjectUpdated = true; + break; + } + } while (false); return isObjectUpdated; } -bool -PFXCategory::isValid() const { +bool PFXCategory::isValid() const { // only required properties are required for the object to be considered valid return true; } -} - +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXCategory.h b/samples/client/petstore/cpp-qt5/client/PFXCategory.h index 6bfe71d7a74..84ce65c6269 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXCategory.h +++ b/samples/client/petstore/cpp-qt5/client/PFXCategory.h @@ -3,7 +3,6 @@ * 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 @@ -21,53 +20,46 @@ #include - #include -#include "PFXObject.h" #include "PFXEnum.h" - +#include "PFXObject.h" namespace test_namespace { -class PFXCategory: public PFXObject { +class PFXCategory : public PFXObject { public: PFXCategory(); PFXCategory(QString json); ~PFXCategory() override; - QString asJson () const override; + QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; - qint64 getId() const; void setId(const qint64 &id); - QString getName() const; void setName(const QString &name); - - virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); - + qint64 id; bool m_id_isSet; bool m_id_isValid; - + QString name; bool m_name_isSet; bool m_name_isValid; - - }; +}; -} +} // namespace test_namespace Q_DECLARE_METATYPE(test_namespace::PFXCategory) diff --git a/samples/client/petstore/cpp-qt5/client/PFXEnum.h b/samples/client/petstore/cpp-qt5/client/PFXEnum.h index 9f3c9328255..c3d19c1a7e2 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXEnum.h +++ b/samples/client/petstore/cpp-qt5/client/PFXEnum.h @@ -3,7 +3,6 @@ * 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 @@ -13,25 +12,21 @@ #ifndef PFX_ENUM_H #define PFX_ENUM_H -#include #include #include +#include namespace test_namespace { class PFXEnum { - public: - PFXEnum() { - - } +public: + PFXEnum() {} PFXEnum(QString jsonString) { fromJson(jsonString); } - virtual ~PFXEnum(){ - - } + virtual ~PFXEnum() {} virtual QJsonValue asJsonValue() const { return QJsonValue(jstr); @@ -56,11 +51,12 @@ class PFXEnum { virtual bool isValid() const { return true; } -private : + +private: QString jstr; }; -} +} // namespace test_namespace Q_DECLARE_METATYPE(test_namespace::PFXEnum) diff --git a/samples/client/petstore/cpp-qt5/client/PFXHelpers.cpp b/samples/client/petstore/cpp-qt5/client/PFXHelpers.cpp index 15ed5d0c1bf..620a5aad65e 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHelpers.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHelpers.cpp @@ -3,253 +3,206 @@ * 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 #include "PFXHelpers.h" - +#include namespace test_namespace { - -QString -toStringValue(const QString &value) { +QString toStringValue(const QString &value) { return value; } -QString -toStringValue(const QDateTime &value){ +QString toStringValue(const QDateTime &value) { // ISO 8601 return value.toString("yyyy-MM-ddTHH:mm:ss[Z|[+|-]HH:mm]"); } -QString -toStringValue(const QByteArray &value){ +QString toStringValue(const QByteArray &value) { return QString(value); } -QString -toStringValue(const QDate &value){ +QString toStringValue(const QDate &value) { // ISO 8601 return value.toString(Qt::DateFormat::ISODate); } -QString -toStringValue(const qint32 &value) { +QString toStringValue(const qint32 &value) { return QString::number(value); } -QString -toStringValue(const qint64 &value) { +QString toStringValue(const qint64 &value) { return QString::number(value); } -QString -toStringValue(const bool &value) { +QString toStringValue(const bool &value) { return QString(value ? "true" : "false"); } -QString -toStringValue(const float &value){ +QString toStringValue(const float &value) { return QString::number(static_cast(value)); } -QString -toStringValue(const double &value){ +QString toStringValue(const double &value) { return QString::number(value); } -QString -toStringValue(const PFXObject &value){ +QString toStringValue(const PFXObject &value) { return value.asJson(); } - -QString -toStringValue(const PFXEnum &value){ +QString toStringValue(const PFXEnum &value) { return value.asJson(); } -QString -toStringValue(const PFXHttpFileElement &value){ +QString toStringValue(const PFXHttpFileElement &value) { return value.asJson(); } - -QJsonValue -toJsonValue(const QString &value){ - return QJsonValue(value); +QJsonValue toJsonValue(const QString &value) { + return QJsonValue(value); } -QJsonValue -toJsonValue(const QDateTime &value){ +QJsonValue toJsonValue(const QDateTime &value) { return QJsonValue(value.toString(Qt::ISODate)); } -QJsonValue -toJsonValue(const QByteArray &value){ +QJsonValue toJsonValue(const QByteArray &value) { return QJsonValue(QString(value.toBase64())); } -QJsonValue -toJsonValue(const QDate &value){ +QJsonValue toJsonValue(const QDate &value) { return QJsonValue(value.toString(Qt::ISODate)); } -QJsonValue -toJsonValue(const qint32 &value){ +QJsonValue toJsonValue(const qint32 &value) { return QJsonValue(value); } -QJsonValue -toJsonValue(const qint64 &value){ +QJsonValue toJsonValue(const qint64 &value) { return QJsonValue(value); } -QJsonValue -toJsonValue(const bool &value){ +QJsonValue toJsonValue(const bool &value) { return QJsonValue(value); } -QJsonValue -toJsonValue(const float &value){ +QJsonValue toJsonValue(const float &value) { return QJsonValue(static_cast(value)); } -QJsonValue -toJsonValue(const double &value){ +QJsonValue toJsonValue(const double &value) { return QJsonValue(value); } -QJsonValue -toJsonValue(const PFXObject &value){ +QJsonValue toJsonValue(const PFXObject &value) { return value.asJsonObject(); } -QJsonValue -toJsonValue(const PFXEnum &value){ +QJsonValue toJsonValue(const PFXEnum &value) { return value.asJsonValue(); } -QJsonValue -toJsonValue(const PFXHttpFileElement &value){ +QJsonValue toJsonValue(const PFXHttpFileElement &value) { return value.asJsonValue(); } - -bool -fromStringValue(const QString &inStr, QString &value){ +bool fromStringValue(const QString &inStr, QString &value) { value.clear(); value.append(inStr); return !inStr.isEmpty(); } -bool -fromStringValue(const QString &inStr, QDateTime &value){ - if(inStr.isEmpty()){ +bool fromStringValue(const QString &inStr, QDateTime &value) { + if (inStr.isEmpty()) { return false; - } - else{ + } else { auto dateTime = QDateTime::fromString(inStr, "yyyy-MM-ddTHH:mm:ss[Z|[+|-]HH:mm]"); - if(dateTime.isValid()){ + if (dateTime.isValid()) { value.setDate(dateTime.date()); value.setTime(dateTime.time()); - } - else{ + } else { qDebug() << "DateTime is invalid"; } return dateTime.isValid(); } } -bool -fromStringValue(const QString &inStr, QByteArray &value){ - if(inStr.isEmpty()){ +bool fromStringValue(const QString &inStr, QByteArray &value) { + if (inStr.isEmpty()) { return false; - } - else{ + } else { value.clear(); value.append(inStr.toUtf8()); return value.count() > 0; } } -bool -fromStringValue(const QString &inStr, QDate &value){ - if(inStr.isEmpty()){ +bool fromStringValue(const QString &inStr, QDate &value) { + if (inStr.isEmpty()) { return false; - } - else{ + } else { auto date = QDate::fromString(inStr, Qt::DateFormat::ISODate); - if(date.isValid()){ + if (date.isValid()) { value.setDate(date.year(), date.month(), date.day()); - } - else{ + } else { qDebug() << "Date is invalid"; } return date.isValid(); } } -bool -fromStringValue(const QString &inStr, qint32 &value){ +bool fromStringValue(const QString &inStr, qint32 &value) { bool ok = false; value = QVariant(inStr).toInt(&ok); return ok; } -bool -fromStringValue(const QString &inStr, qint64 &value){ +bool fromStringValue(const QString &inStr, qint64 &value) { bool ok = false; value = QVariant(inStr).toLongLong(&ok); return ok; } -bool -fromStringValue(const QString &inStr, bool &value){ +bool fromStringValue(const QString &inStr, bool &value) { value = QVariant(inStr).toBool(); return ((inStr == "true") || (inStr == "false")); } -bool -fromStringValue(const QString &inStr, float &value){ +bool fromStringValue(const QString &inStr, float &value) { bool ok = false; value = QVariant(inStr).toFloat(&ok); return ok; } -bool -fromStringValue(const QString &inStr, double &value){ +bool fromStringValue(const QString &inStr, double &value) { bool ok = false; value = QVariant(inStr).toDouble(&ok); return ok; } -bool -fromStringValue(const QString &inStr, PFXEnum &value){ +bool fromStringValue(const QString &inStr, PFXEnum &value) { value.fromJson(inStr); return true; } -bool -fromStringValue(const QString &inStr, PFXHttpFileElement &value){ +bool fromStringValue(const QString &inStr, PFXHttpFileElement &value) { return value.fromStringValue(inStr); } -bool -fromJsonValue(QString &value, const QJsonValue &jval){ +bool fromJsonValue(QString &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull()){ - if(jval.isString()){ + if (!jval.isUndefined() && !jval.isNull()) { + if (jval.isString()) { value = jval.toString(); - } else if(jval.isBool()) { - value = jval.toBool() ? "true" : "false"; - } else if(jval.isDouble()){ + } else if (jval.isBool()) { + value = jval.toBool() ? "true" : "false"; + } else if (jval.isDouble()) { value = QString::number(jval.toDouble()); } else { ok = false; @@ -260,10 +213,9 @@ fromJsonValue(QString &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(QDateTime &value, const QJsonValue &jval){ +bool fromJsonValue(QDateTime &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && jval.isString()){ + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { value = QDateTime::fromString(jval.toString(), Qt::ISODate); ok = value.isValid(); } else { @@ -272,22 +224,20 @@ fromJsonValue(QDateTime &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(QByteArray &value, const QJsonValue &jval){ +bool fromJsonValue(QByteArray &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && jval.isString()) { + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { value = QByteArray::fromBase64(QByteArray::fromStdString(jval.toString().toStdString())); - ok = value.size() > 0 ; + ok = value.size() > 0; } else { ok = false; } return ok; } -bool -fromJsonValue(QDate &value, const QJsonValue &jval){ +bool fromJsonValue(QDate &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && jval.isString()){ + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { value = QDate::fromString(jval.toString(), Qt::ISODate); ok = value.isValid(); } else { @@ -296,10 +246,9 @@ fromJsonValue(QDate &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(qint32 &value, const QJsonValue &jval){ +bool fromJsonValue(qint32 &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()){ + if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { value = jval.toInt(); } else { ok = false; @@ -307,10 +256,9 @@ fromJsonValue(qint32 &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(qint64 &value, const QJsonValue &jval){ +bool fromJsonValue(qint64 &value, const QJsonValue &jval) { bool ok = true; - if(!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()){ + if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { value = jval.toVariant().toLongLong(); } else { ok = false; @@ -318,10 +266,9 @@ fromJsonValue(qint64 &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(bool &value, const QJsonValue &jval){ +bool fromJsonValue(bool &value, const QJsonValue &jval) { bool ok = true; - if(jval.isBool()){ + if (jval.isBool()) { value = jval.toBool(); } else { ok = false; @@ -329,10 +276,9 @@ fromJsonValue(bool &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(float &value, const QJsonValue &jval){ +bool fromJsonValue(float &value, const QJsonValue &jval) { bool ok = true; - if(jval.isDouble()){ + if (jval.isDouble()) { value = static_cast(jval.toDouble()); } else { ok = false; @@ -340,10 +286,9 @@ fromJsonValue(float &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(double &value, const QJsonValue &jval){ +bool fromJsonValue(double &value, const QJsonValue &jval) { bool ok = true; - if(jval.isDouble()){ + if (jval.isDouble()) { value = jval.toDouble(); } else { ok = false; @@ -351,10 +296,9 @@ fromJsonValue(double &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(PFXObject &value, const QJsonValue &jval){ +bool fromJsonValue(PFXObject &value, const QJsonValue &jval) { bool ok = true; - if(jval.isObject()){ + if (jval.isObject()) { value.fromJsonObject(jval.toObject()); ok = value.isValid(); } else { @@ -363,15 +307,13 @@ fromJsonValue(PFXObject &value, const QJsonValue &jval){ return ok; } -bool -fromJsonValue(PFXEnum &value, const QJsonValue &jval){ +bool fromJsonValue(PFXEnum &value, const QJsonValue &jval) { value.fromJsonValue(jval); return true; } -bool -fromJsonValue(PFXHttpFileElement &value, const QJsonValue &jval){ +bool fromJsonValue(PFXHttpFileElement &value, const QJsonValue &jval) { return value.fromJsonValue(jval); } -} +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXHelpers.h b/samples/client/petstore/cpp-qt5/client/PFXHelpers.h index 13b15dabdb2..e8c0ee7f941 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHelpers.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHelpers.h @@ -3,7 +3,6 @@ * 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 @@ -13,180 +12,180 @@ #ifndef PFX_HELPERS_H #define PFX_HELPERS_H -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include #include -#include "PFXObject.h" #include "PFXEnum.h" #include "PFXHttpFileElement.h" +#include "PFXObject.h" namespace test_namespace { - template QString - toStringValue(const QList &val); +template +QString toStringValue(const QList &val); - template - bool fromStringValue(const QList &inStr, QList &val); +template +bool fromStringValue(const QList &inStr, QList &val); - template - bool fromStringValue(const QMap &inStr, QMap &val); +template +bool fromStringValue(const QMap &inStr, QMap &val); - template - QJsonValue toJsonValue(const QList &val); +template +QJsonValue toJsonValue(const QList &val); - template - QJsonValue toJsonValue(const QMap &val); +template +QJsonValue toJsonValue(const QMap &val); - template - bool fromJsonValue(QList &val, const QJsonValue &jval); +template +bool fromJsonValue(QList &val, const QJsonValue &jval); - template - bool fromJsonValue(QMap &val, const QJsonValue &jval); - - QString toStringValue(const QString &value); - QString toStringValue(const QDateTime &value); - QString toStringValue(const QByteArray &value); - QString toStringValue(const QDate &value); - QString toStringValue(const qint32 &value); - QString toStringValue(const qint64 &value); - QString toStringValue(const bool &value); - QString toStringValue(const float &value); - QString toStringValue(const double &value); - QString toStringValue(const PFXObject &value); - QString toStringValue(const PFXEnum &value); - QString toStringValue(const PFXHttpFileElement &value); +template +bool fromJsonValue(QMap &val, const QJsonValue &jval); - template - QString toStringValue(const QList &val) { - QString strArray; - for(const auto& item : val) { - strArray.append(toStringValue(item) + ","); - } - if(val.count() > 0) { - strArray.chop(1); - } - return strArray; +QString toStringValue(const QString &value); +QString toStringValue(const QDateTime &value); +QString toStringValue(const QByteArray &value); +QString toStringValue(const QDate &value); +QString toStringValue(const qint32 &value); +QString toStringValue(const qint64 &value); +QString toStringValue(const bool &value); +QString toStringValue(const float &value); +QString toStringValue(const double &value); +QString toStringValue(const PFXObject &value); +QString toStringValue(const PFXEnum &value); +QString toStringValue(const PFXHttpFileElement &value); + +template +QString toStringValue(const QList &val) { + QString strArray; + for (const auto &item : val) { + strArray.append(toStringValue(item) + ","); } - - QJsonValue toJsonValue(const QString &value); - QJsonValue toJsonValue(const QDateTime &value); - QJsonValue toJsonValue(const QByteArray &value); - QJsonValue toJsonValue(const QDate &value); - QJsonValue toJsonValue(const qint32 &value); - QJsonValue toJsonValue(const qint64 &value); - QJsonValue toJsonValue(const bool &value); - QJsonValue toJsonValue(const float &value); - QJsonValue toJsonValue(const double &value); - QJsonValue toJsonValue(const PFXObject &value); - QJsonValue toJsonValue(const PFXEnum &value); - QJsonValue toJsonValue(const PFXHttpFileElement &value); - - template - QJsonValue toJsonValue(const QList &val) { - QJsonArray jArray; - for(const auto& item : val) { - jArray.append(toJsonValue(item)); - } - return jArray; + if (val.count() > 0) { + strArray.chop(1); } - - template - QJsonValue toJsonValue(const QMap &val) { - QJsonObject jObject; - for(const auto& itemkey : val.keys()) { - jObject.insert(itemkey, toJsonValue(val.value(itemkey))); - } - return jObject; - } - - bool fromStringValue(const QString &inStr, QString &value); - bool fromStringValue(const QString &inStr, QDateTime &value); - bool fromStringValue(const QString &inStr, QByteArray &value); - bool fromStringValue(const QString &inStr, QDate &value); - bool fromStringValue(const QString &inStr, qint32 &value); - bool fromStringValue(const QString &inStr, qint64 &value); - bool fromStringValue(const QString &inStr, bool &value); - bool fromStringValue(const QString &inStr, float &value); - bool fromStringValue(const QString &inStr, double &value); - bool fromStringValue(const QString &inStr, PFXObject &value); - bool fromStringValue(const QString &inStr, PFXEnum &value); - bool fromStringValue(const QString &inStr, PFXHttpFileElement &value); - - template - bool fromStringValue(const QList &inStr, QList &val) { - bool ok = (inStr.count() > 0); - for(const auto& item: inStr){ - T itemVal; - ok &= fromStringValue(item, itemVal); - val.push_back(itemVal); - } - return ok; - } - - template - bool fromStringValue(const QMap &inStr, QMap &val) { - bool ok = (inStr.count() > 0); - for(const auto& itemkey : inStr.keys()){ - T itemVal; - ok &= fromStringValue(inStr.value(itemkey), itemVal); - val.insert(itemkey, itemVal); - } - return ok; - } - - bool fromJsonValue(QString &value, const QJsonValue &jval); - bool fromJsonValue(QDateTime &value, const QJsonValue &jval); - bool fromJsonValue(QByteArray &value, const QJsonValue &jval); - bool fromJsonValue(QDate &value, const QJsonValue &jval); - bool fromJsonValue(qint32 &value, const QJsonValue &jval); - bool fromJsonValue(qint64 &value, const QJsonValue &jval); - bool fromJsonValue(bool &value, const QJsonValue &jval); - bool fromJsonValue(float &value, const QJsonValue &jval); - bool fromJsonValue(double &value, const QJsonValue &jval); - bool fromJsonValue(PFXObject &value, const QJsonValue &jval); - bool fromJsonValue(PFXEnum &value, const QJsonValue &jval); - bool fromJsonValue(PFXHttpFileElement &value, const QJsonValue &jval); - - template - bool fromJsonValue(QList &val, const QJsonValue &jval) { - bool ok = true; - if(jval.isArray()){ - for(const auto jitem : jval.toArray()){ - T item; - ok &= fromJsonValue(item, jitem); - val.push_back(item); - } - } else { - ok = false; - } - return ok; - } - - template - bool fromJsonValue(QMap &val, const QJsonValue &jval) { - bool ok = true; - if(jval.isObject()){ - auto varmap = jval.toObject().toVariantMap(); - if(varmap.count() > 0){ - for(const auto& itemkey : varmap.keys() ){ - T itemVal; - ok &= fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); - val.insert(itemkey, itemVal); - } - } - } else { - ok = false; - } - return ok; - } - + return strArray; } +QJsonValue toJsonValue(const QString &value); +QJsonValue toJsonValue(const QDateTime &value); +QJsonValue toJsonValue(const QByteArray &value); +QJsonValue toJsonValue(const QDate &value); +QJsonValue toJsonValue(const qint32 &value); +QJsonValue toJsonValue(const qint64 &value); +QJsonValue toJsonValue(const bool &value); +QJsonValue toJsonValue(const float &value); +QJsonValue toJsonValue(const double &value); +QJsonValue toJsonValue(const PFXObject &value); +QJsonValue toJsonValue(const PFXEnum &value); +QJsonValue toJsonValue(const PFXHttpFileElement &value); + +template +QJsonValue toJsonValue(const QList &val) { + QJsonArray jArray; + for (const auto &item : val) { + jArray.append(toJsonValue(item)); + } + return jArray; +} + +template +QJsonValue toJsonValue(const QMap &val) { + QJsonObject jObject; + for (const auto &itemkey : val.keys()) { + jObject.insert(itemkey, toJsonValue(val.value(itemkey))); + } + return jObject; +} + +bool fromStringValue(const QString &inStr, QString &value); +bool fromStringValue(const QString &inStr, QDateTime &value); +bool fromStringValue(const QString &inStr, QByteArray &value); +bool fromStringValue(const QString &inStr, QDate &value); +bool fromStringValue(const QString &inStr, qint32 &value); +bool fromStringValue(const QString &inStr, qint64 &value); +bool fromStringValue(const QString &inStr, bool &value); +bool fromStringValue(const QString &inStr, float &value); +bool fromStringValue(const QString &inStr, double &value); +bool fromStringValue(const QString &inStr, PFXObject &value); +bool fromStringValue(const QString &inStr, PFXEnum &value); +bool fromStringValue(const QString &inStr, PFXHttpFileElement &value); + +template +bool fromStringValue(const QList &inStr, QList &val) { + bool ok = (inStr.count() > 0); + for (const auto &item : inStr) { + T itemVal; + ok &= fromStringValue(item, itemVal); + val.push_back(itemVal); + } + return ok; +} + +template +bool fromStringValue(const QMap &inStr, QMap &val) { + bool ok = (inStr.count() > 0); + for (const auto &itemkey : inStr.keys()) { + T itemVal; + ok &= fromStringValue(inStr.value(itemkey), itemVal); + val.insert(itemkey, itemVal); + } + return ok; +} + +bool fromJsonValue(QString &value, const QJsonValue &jval); +bool fromJsonValue(QDateTime &value, const QJsonValue &jval); +bool fromJsonValue(QByteArray &value, const QJsonValue &jval); +bool fromJsonValue(QDate &value, const QJsonValue &jval); +bool fromJsonValue(qint32 &value, const QJsonValue &jval); +bool fromJsonValue(qint64 &value, const QJsonValue &jval); +bool fromJsonValue(bool &value, const QJsonValue &jval); +bool fromJsonValue(float &value, const QJsonValue &jval); +bool fromJsonValue(double &value, const QJsonValue &jval); +bool fromJsonValue(PFXObject &value, const QJsonValue &jval); +bool fromJsonValue(PFXEnum &value, const QJsonValue &jval); +bool fromJsonValue(PFXHttpFileElement &value, const QJsonValue &jval); + +template +bool fromJsonValue(QList &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isArray()) { + for (const auto jitem : jval.toArray()) { + T item; + ok &= fromJsonValue(item, jitem); + val.push_back(item); + } + } else { + ok = false; + } + return ok; +} + +template +bool fromJsonValue(QMap &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isObject()) { + auto varmap = jval.toObject().toVariantMap(); + if (varmap.count() > 0) { + for (const auto &itemkey : varmap.keys()) { + T itemVal; + ok &= fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); + val.insert(itemkey, itemVal); + } + } + } else { + ok = false; + } + return ok; +} + +} // namespace test_namespace + #endif // PFX_HELPERS_H diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp index c2616877958..ef9e00ebea0 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp @@ -3,14 +3,12 @@ * 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 #include #include @@ -20,129 +18,117 @@ namespace test_namespace { -void -PFXHttpFileElement::setMimeType(const QString &mime){ +void PFXHttpFileElement::setMimeType(const QString &mime) { mime_type = mime; } -void -PFXHttpFileElement::setFileName(const QString &name){ +void PFXHttpFileElement::setFileName(const QString &name) { local_filename = name; } -void -PFXHttpFileElement::setVariableName(const QString &name){ +void PFXHttpFileElement::setVariableName(const QString &name) { variable_name = name; } -void -PFXHttpFileElement::setRequestFileName(const QString &name){ +void PFXHttpFileElement::setRequestFileName(const QString &name) { request_filename = name; } -bool -PFXHttpFileElement::isSet() const { +bool PFXHttpFileElement::isSet() const { return !local_filename.isEmpty() || !request_filename.isEmpty(); } -QString -PFXHttpFileElement::asJson() const{ +QString PFXHttpFileElement::asJson() const { QFile file(local_filename); QByteArray bArray; bool result = false; - if(file.exists()) { + if (file.exists()) { result = file.open(QIODevice::ReadOnly); bArray = file.readAll(); file.close(); } - if(!result) { + if (!result) { qDebug() << "Error opening file " << local_filename; } return QString(bArray); } -QJsonValue -PFXHttpFileElement::asJsonValue() const{ +QJsonValue PFXHttpFileElement::asJsonValue() const { QFile file(local_filename); QByteArray bArray; - bool result = false; - if(file.exists()) { + bool result = false; + if (file.exists()) { result = file.open(QIODevice::ReadOnly); bArray = file.readAll(); file.close(); } - if(!result) { + if (!result) { qDebug() << "Error opening file " << local_filename; } return QJsonDocument::fromBinaryData(bArray.data()).object(); } -bool -PFXHttpFileElement::fromStringValue(const QString &instr){ +bool PFXHttpFileElement::fromStringValue(const QString &instr) { QFile file(local_filename); bool result = false; - if(file.exists()) { + if (file.exists()) { file.remove(); } result = file.open(QIODevice::WriteOnly); file.write(instr.toUtf8()); file.close(); - if(!result) { + if (!result) { qDebug() << "Error creating file " << local_filename; } return result; } -bool -PFXHttpFileElement::fromJsonValue(const QJsonValue &jval) { +bool PFXHttpFileElement::fromJsonValue(const QJsonValue &jval) { QFile file(local_filename); bool result = false; - if(file.exists()) { + if (file.exists()) { file.remove(); } result = file.open(QIODevice::WriteOnly); file.write(QJsonDocument(jval.toObject()).toBinaryData()); file.close(); - if(!result) { + if (!result) { qDebug() << "Error creating file " << local_filename; } return result; } -QByteArray -PFXHttpFileElement::asByteArray() const { +QByteArray PFXHttpFileElement::asByteArray() const { QFile file(local_filename); QByteArray bArray; bool result = false; - if(file.exists()) { + if (file.exists()) { result = file.open(QIODevice::ReadOnly); bArray = file.readAll(); file.close(); } - if(!result) { + if (!result) { qDebug() << "Error opening file " << local_filename; - } + } return bArray; } -bool -PFXHttpFileElement::fromByteArray(const QByteArray& bytes){ +bool PFXHttpFileElement::fromByteArray(const QByteArray &bytes) { QFile file(local_filename); bool result = false; - if(file.exists()){ + if (file.exists()) { file.remove(); } result = file.open(QIODevice::WriteOnly); file.write(bytes); file.close(); - if(!result) { + if (!result) { qDebug() << "Error creating file " << local_filename; } return result; } -bool -PFXHttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray& bytes){ +bool PFXHttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray &bytes) { setMimeType(mime); setFileName(localFName); setVariableName(varName); @@ -150,8 +136,7 @@ PFXHttpFileElement::saveToFile(const QString &varName, const QString &localFName return fromByteArray(bytes); } -QByteArray -PFXHttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime){ +QByteArray PFXHttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime) { setMimeType(mime); setFileName(localFName); setVariableName(varName); @@ -159,4 +144,4 @@ PFXHttpFileElement::loadFromFile(const QString &varName, const QString &localFNa return asByteArray(); } -} +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.h b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.h index af819aff761..799a8c2c02a 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.h @@ -3,7 +3,6 @@ * 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 @@ -17,7 +16,6 @@ #include #include - namespace test_namespace { class PFXHttpFileElement { @@ -34,15 +32,15 @@ public: bool isSet() const; bool fromStringValue(const QString &instr); bool fromJsonValue(const QJsonValue &jval); - bool fromByteArray(const QByteArray& bytes); - bool saveToFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime, const QByteArray& bytes); + bool fromByteArray(const QByteArray &bytes); + bool saveToFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime, const QByteArray &bytes); QString asJson() const; QJsonValue asJsonValue() const; QByteArray asByteArray() const; QByteArray loadFromFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime); }; -} +} // namespace test_namespace Q_DECLARE_METATYPE(test_namespace::PFXHttpFileElement) diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp index 951b9b911f0..30f1c04800c 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp @@ -3,27 +3,23 @@ * 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 #include #include -#include -#include #include -#include -#include #include +#include +#include +#include #include "PFXHttpRequest.h" - namespace test_namespace { PFXHttpRequestInput::PFXHttpRequestInput() { @@ -55,61 +51,58 @@ void PFXHttpRequestInput::add_file(QString variable_name, QString local_filename files.append(file); } - PFXHttpRequestWorker::PFXHttpRequestWorker(QObject *parent) - : QObject(parent), manager(nullptr), _timeOut(0) -{ + : QObject(parent), manager(nullptr), _timeOut(0) { qsrand(QDateTime::currentDateTime().toTime_t()); manager = new QNetworkAccessManager(this); - workingDirectory = QDir::currentPath(); + workingDirectory = QDir::currentPath(); connect(manager, &QNetworkAccessManager::finished, this, &PFXHttpRequestWorker::on_manager_finished); } PFXHttpRequestWorker::~PFXHttpRequestWorker() { - for (const auto & item: multiPartFields) { - if(item != nullptr) { + for (const auto &item : multiPartFields) { + if (item != nullptr) { delete item; } - } + } } QMap PFXHttpRequestWorker::getResponseHeaders() const { return headers; } -PFXHttpFileElement PFXHttpRequestWorker::getHttpFileElement(const QString &fieldname){ - if(!files.isEmpty()){ - if(fieldname.isEmpty()){ +PFXHttpFileElement PFXHttpRequestWorker::getHttpFileElement(const QString &fieldname) { + if (!files.isEmpty()) { + if (fieldname.isEmpty()) { return files.first(); - }else if (files.contains(fieldname)){ + } else if (files.contains(fieldname)) { return files[fieldname]; } } return PFXHttpFileElement(); } -QByteArray *PFXHttpRequestWorker::getMultiPartField(const QString &fieldname){ - if(!multiPartFields.isEmpty()){ - if(fieldname.isEmpty()){ +QByteArray *PFXHttpRequestWorker::getMultiPartField(const QString &fieldname) { + if (!multiPartFields.isEmpty()) { + if (fieldname.isEmpty()) { return multiPartFields.first(); - }else if (multiPartFields.contains(fieldname)){ + } else if (multiPartFields.contains(fieldname)) { return multiPartFields[fieldname]; } } return nullptr; } -void PFXHttpRequestWorker::setTimeOut(int timeOut){ +void PFXHttpRequestWorker::setTimeOut(int timeOut) { _timeOut = timeOut; } -void PFXHttpRequestWorker::setWorkingDirectory(const QString &path){ - if(!path.isEmpty()){ +void PFXHttpRequestWorker::setWorkingDirectory(const QString &path) { + if (!path.isEmpty()) { workingDirectory = path; } } - QString PFXHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { // result structure follows RFC 5987 bool need_utf_encoding = false; @@ -121,11 +114,9 @@ QString PFXHttpRequestWorker::http_attribute_encode(QString attribute_name, QStr if (c == '\\' || c == '/' || c == '\0' || c < ' ' || c > '~') { // ignore and request utf-8 version need_utf_encoding = true; - } - else if (c == '"') { + } else if (c == '"') { result += "\\\""; - } - else { + } else { result += c; } } @@ -142,14 +133,9 @@ QString PFXHttpRequestWorker::http_attribute_encode(QString attribute_name, QStr QString result_utf8 = ""; for (int i = 0; i < input_c.length(); i++) { c = input_c.at(i); - if ( - (c >= '0' && c <= '9') - || (c >= 'A' && c <= 'Z') - || (c >= 'a' && c <= 'z') - ) { + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { result_utf8 += c; - } - else { + } else { result_utf8 += "%" + QString::number(static_cast(input_c.at(i)), 16).toUpper(); } } @@ -161,14 +147,13 @@ QString PFXHttpRequestWorker::http_attribute_encode(QString attribute_name, QStr void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { // reset variables - QNetworkReply* reply = nullptr; + QNetworkReply *reply = nullptr; QByteArray request_content = ""; response = ""; error_type = QNetworkReply::NoError; error_str = ""; bool isFormData = false; - // decide on the variable layout if (input->files.length() > 0) { @@ -178,7 +163,6 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { input->var_layout = input->http_method == "GET" || input->http_method == "HEAD" ? ADDRESS : URL_ENCODED; } - // prepare request content QString boundary = ""; @@ -205,13 +189,12 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { request_content = ""; } } - } - else { + } else { // variable layout is MULTIPART - boundary = "__-----------------------" - + QString::number(QDateTime::currentDateTime().toTime_t()) - + QString::number(qrand()); + boundary = QString("__-----------------------%1%2") + .arg(QDateTime::currentDateTime().toTime_t()) + .arg(qrand()); QString boundary_delimiter = "--"; QString new_line = "\r\n"; @@ -242,11 +225,13 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { QFileInfo fi(file_info->local_filename); // ensure necessary variables are available - if ( - file_info->local_filename == nullptr || file_info->local_filename.isEmpty() - || file_info->variable_name == nullptr || file_info->variable_name.isEmpty() - || !fi.exists() || !fi.isFile() || !fi.isReadable() - ) { + if (file_info->local_filename == nullptr + || file_info->local_filename.isEmpty() + || file_info->variable_name == nullptr + || file_info->variable_name.isEmpty() + || !fi.exists() + || !fi.isFile() + || !fi.isReadable()) { // silent abort for the current file continue; } @@ -271,10 +256,8 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { request_content.append(new_line); // add header - request_content.append(QString("Content-Disposition: form-data; %1; %2").arg( - http_attribute_encode("name", file_info->variable_name), - http_attribute_encode("filename", file_info->request_filename) - )); + request_content.append( + QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename))); request_content.append(new_line); if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { @@ -302,7 +285,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { request_content.append(boundary_delimiter); } - if(input->request_body.size() > 0) { + if (input->request_body.size() > 0) { qDebug() << "got a request body"; request_content.clear(); request_content.append(input->request_body); @@ -314,41 +297,31 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { request.setSslConfiguration(*PFXHttpRequestWorker::sslDefaultConfiguration); } request.setRawHeader("User-Agent", "OpenAPI-Generator/1.0.0/cpp-qt5"); - foreach(QString key, input->headers.keys()) { - request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); - } + foreach (QString key, input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); } if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) { - if(!input->headers.contains("Content-Type")){ + if (!input->headers.contains("Content-Type")) { request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); - } - else { + } else { request.setHeader(QNetworkRequest::ContentTypeHeader, input->headers.value("Content-Type")); } - } - else if (input->var_layout == URL_ENCODED) { + } else if (input->var_layout == URL_ENCODED) { request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - } - else if (input->var_layout == MULTIPART) { + } else if (input->var_layout == MULTIPART) { request.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=" + boundary); } if (input->http_method == "GET") { reply = manager->get(request); - } - else if (input->http_method == "POST") { + } else if (input->http_method == "POST") { reply = manager->post(request, request_content); - } - else if (input->http_method == "PUT") { + } else if (input->http_method == "PUT") { reply = manager->put(request, request_content); - } - else if (input->http_method == "HEAD") { + } else if (input->http_method == "HEAD") { reply = manager->head(request); - } - else if (input->http_method == "DELETE") { + } else if (input->http_method == "DELETE") { reply = manager->deleteResource(request); - } - else { + } else { #if (QT_VERSION >= 0x050800) manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); #else @@ -360,8 +333,8 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { buffer->setParent(reply); #endif } - if(_timeOut > 0){ - QTimer::singleShot(_timeOut, [=](){ on_manager_timeout(reply); }); + if (_timeOut > 0) { + QTimer::singleShot(_timeOut, [=]() { on_manager_timeout(reply); }); } } @@ -369,8 +342,8 @@ void PFXHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { error_type = reply->error(); response = reply->readAll(); error_str = reply->errorString(); - if(reply->rawHeaderPairs().count() > 0){ - for(const auto& item: reply->rawHeaderPairs()){ + if (reply->rawHeaderPairs().count() > 0) { + for (const auto &item : reply->rawHeaderPairs()) { headers.insert(item.first, item.second); } } @@ -390,34 +363,31 @@ void PFXHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) { } void PFXHttpRequestWorker::process_form_response() { - if(getResponseHeaders().contains(QString("Content-Disposition")) ) { + if (getResponseHeaders().contains(QString("Content-Disposition"))) { auto contentDisposition = getResponseHeaders().value(QString("Content-Disposition").toUtf8()).split(QString(";"), QString::SkipEmptyParts); - auto contentType = getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts).first() : QString(); - if((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))){ + auto contentType = + getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts).first() : QString(); + if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { QString filename = QUuid::createUuid().toString(); - for(const auto &file : contentDisposition){ - if(file.contains(QString("filename"))){ + for (const auto &file : contentDisposition) { + if (file.contains(QString("filename"))) { filename = file.split(QString("="), QString::SkipEmptyParts).at(1); break; } } PFXHttpFileElement felement; felement.saveToFile(QString(), workingDirectory + QDir::separator() + filename, filename, contentType, response.data()); - files.insert(filename, felement); + files.insert(filename, felement); } - } else if(getResponseHeaders().contains(QString("Content-Type")) ) { + } else if (getResponseHeaders().contains(QString("Content-Type"))) { auto contentType = getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts); - if((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))){ - - } - else { - + if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { + } else { } } } -QSslConfiguration* PFXHttpRequestWorker::sslDefaultConfiguration; +QSslConfiguration *PFXHttpRequestWorker::sslDefaultConfiguration; - -} +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h index 3ca8e2f8c72..6b354142d28 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h @@ -3,7 +3,6 @@ * 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 @@ -19,18 +18,22 @@ #ifndef PFX_HTTPREQUESTWORKER_H #define PFX_HTTPREQUESTWORKER_H -#include -#include #include #include #include +#include +#include #include "PFXHttpFileElement.h" namespace test_namespace { -enum PFXHttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART}; - +enum PFXHttpRequestVarLayout { + NOT_SET, + ADDRESS, + URL_ENCODED, + MULTIPART +}; class PFXHttpRequestInput { @@ -48,10 +51,8 @@ public: void initialize(); void add_var(QString key, QString value); void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type); - }; - class PFXHttpRequestWorker : public QObject { Q_OBJECT @@ -65,11 +66,11 @@ public: QMap getResponseHeaders() const; QString http_attribute_encode(QString attribute_name, QString input); void execute(PFXHttpRequestInput *input); - static QSslConfiguration* sslDefaultConfiguration; + static QSslConfiguration *sslDefaultConfiguration; void setTimeOut(int tout); void setWorkingDirectory(const QString &path); PFXHttpFileElement getHttpFileElement(const QString &fieldname = QString()); - QByteArray* getMultiPartField(const QString &fieldname = QString()); + QByteArray *getMultiPartField(const QString &fieldname = QString()); signals: void on_execution_finished(PFXHttpRequestWorker *worker); @@ -77,15 +78,15 @@ private: QNetworkAccessManager *manager; QMap headers; QMap files; - QMap multiPartFields; + QMap multiPartFields; QString workingDirectory; int _timeOut; void on_manager_timeout(QNetworkReply *reply); - void process_form_response(); + void process_form_response(); private slots: void on_manager_finished(QNetworkReply *reply); }; -} +} // namespace test_namespace #endif // PFX_HTTPREQUESTWORKER_H diff --git a/samples/client/petstore/cpp-qt5/client/PFXObject.h b/samples/client/petstore/cpp-qt5/client/PFXObject.h index fb6004bbbc3..c4be9917a32 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXObject.h +++ b/samples/client/petstore/cpp-qt5/client/PFXObject.h @@ -3,7 +3,6 @@ * 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 @@ -13,25 +12,21 @@ #ifndef PFX_OBJECT_H #define PFX_OBJECT_H -#include #include +#include #include namespace test_namespace { class PFXObject { - public: - PFXObject() { - - } +public: + PFXObject() {} PFXObject(QString jsonString) { fromJson(jsonString); } - virtual ~PFXObject(){ - - } + virtual ~PFXObject() {} virtual QJsonObject asJsonObject() const { return jObj; @@ -58,11 +53,12 @@ class PFXObject { virtual bool isValid() const { return true; } -private : + +private: QJsonObject jObj; }; -} +} // namespace test_namespace Q_DECLARE_METATYPE(test_namespace::PFXObject) diff --git a/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp b/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp index 5887591617c..b62979c8fef 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp @@ -3,20 +3,18 @@ * 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 "PFXOrder.h" -#include -#include -#include #include +#include +#include +#include #include "PFXHelpers.h" @@ -31,186 +29,174 @@ PFXOrder::PFXOrder() { this->initializeModel(); } -PFXOrder::~PFXOrder() { +PFXOrder::~PFXOrder() {} -} +void PFXOrder::initializeModel() { -void -PFXOrder::initializeModel() { - m_id_isSet = false; m_id_isValid = false; - + m_pet_id_isSet = false; m_pet_id_isValid = false; - + m_quantity_isSet = false; m_quantity_isValid = false; - + m_ship_date_isSet = false; m_ship_date_isValid = false; - + m_status_isSet = false; m_status_isValid = false; - + m_complete_isSet = false; m_complete_isValid = false; - } -void -PFXOrder::fromJson(QString jsonString) { - QByteArray array (jsonString.toStdString().c_str()); +void PFXOrder::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } -void -PFXOrder::fromJsonObject(QJsonObject json) { - +void PFXOrder::fromJsonObject(QJsonObject json) { + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - + m_pet_id_isValid = ::test_namespace::fromJsonValue(pet_id, json[QString("petId")]); m_pet_id_isSet = !json[QString("petId")].isNull() && m_pet_id_isValid; - + m_quantity_isValid = ::test_namespace::fromJsonValue(quantity, json[QString("quantity")]); m_quantity_isSet = !json[QString("quantity")].isNull() && m_quantity_isValid; - + m_ship_date_isValid = ::test_namespace::fromJsonValue(ship_date, json[QString("shipDate")]); m_ship_date_isSet = !json[QString("shipDate")].isNull() && m_ship_date_isValid; - + m_status_isValid = ::test_namespace::fromJsonValue(status, json[QString("status")]); m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; - + m_complete_isValid = ::test_namespace::fromJsonValue(complete, json[QString("complete")]); m_complete_isSet = !json[QString("complete")].isNull() && m_complete_isValid; - } -QString -PFXOrder::asJson () const { +QString PFXOrder::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } -QJsonObject -PFXOrder::asJsonObject() const { +QJsonObject PFXOrder::asJsonObject() const { QJsonObject obj; - if(m_id_isSet){ + if (m_id_isSet) { obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } - if(m_pet_id_isSet){ + if (m_pet_id_isSet) { obj.insert(QString("petId"), ::test_namespace::toJsonValue(pet_id)); } - if(m_quantity_isSet){ + if (m_quantity_isSet) { obj.insert(QString("quantity"), ::test_namespace::toJsonValue(quantity)); } - if(m_ship_date_isSet){ + if (m_ship_date_isSet) { obj.insert(QString("shipDate"), ::test_namespace::toJsonValue(ship_date)); } - if(m_status_isSet){ + if (m_status_isSet) { obj.insert(QString("status"), ::test_namespace::toJsonValue(status)); } - if(m_complete_isSet){ + if (m_complete_isSet) { obj.insert(QString("complete"), ::test_namespace::toJsonValue(complete)); } return obj; } - -qint64 -PFXOrder::getId() const { +qint64 PFXOrder::getId() const { return id; } -void -PFXOrder::setId(const qint64 &id) { +void PFXOrder::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } - -qint64 -PFXOrder::getPetId() const { +qint64 PFXOrder::getPetId() const { return pet_id; } -void -PFXOrder::setPetId(const qint64 &pet_id) { +void PFXOrder::setPetId(const qint64 &pet_id) { this->pet_id = pet_id; this->m_pet_id_isSet = true; } - -qint32 -PFXOrder::getQuantity() const { +qint32 PFXOrder::getQuantity() const { return quantity; } -void -PFXOrder::setQuantity(const qint32 &quantity) { +void PFXOrder::setQuantity(const qint32 &quantity) { this->quantity = quantity; this->m_quantity_isSet = true; } - -QDateTime -PFXOrder::getShipDate() const { +QDateTime PFXOrder::getShipDate() const { return ship_date; } -void -PFXOrder::setShipDate(const QDateTime &ship_date) { +void PFXOrder::setShipDate(const QDateTime &ship_date) { this->ship_date = ship_date; this->m_ship_date_isSet = true; } - -QString -PFXOrder::getStatus() const { +QString PFXOrder::getStatus() const { return status; } -void -PFXOrder::setStatus(const QString &status) { +void PFXOrder::setStatus(const QString &status) { this->status = status; this->m_status_isSet = true; } - -bool -PFXOrder::isComplete() const { +bool PFXOrder::isComplete() const { return complete; } -void -PFXOrder::setComplete(const bool &complete) { +void PFXOrder::setComplete(const bool &complete) { this->complete = complete; this->m_complete_isSet = true; } -bool -PFXOrder::isSet() const { +bool PFXOrder::isSet() const { bool isObjectUpdated = false; - do{ - if(m_id_isSet){ isObjectUpdated = true; break;} - - if(m_pet_id_isSet){ isObjectUpdated = true; break;} - - if(m_quantity_isSet){ isObjectUpdated = true; break;} - - if(m_ship_date_isSet){ isObjectUpdated = true; break;} - - if(m_status_isSet){ isObjectUpdated = true; break;} - - if(m_complete_isSet){ isObjectUpdated = true; break;} - }while(false); + do { + if (m_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_pet_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_quantity_isSet) { + isObjectUpdated = true; + break; + } + + if (m_ship_date_isSet) { + isObjectUpdated = true; + break; + } + + if (m_status_isSet) { + isObjectUpdated = true; + break; + } + + if (m_complete_isSet) { + isObjectUpdated = true; + break; + } + } while (false); return isObjectUpdated; } -bool -PFXOrder::isValid() const { +bool PFXOrder::isValid() const { // only required properties are required for the object to be considered valid return true; } -} - +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXOrder.h b/samples/client/petstore/cpp-qt5/client/PFXOrder.h index 34fc7eb1f55..1c100268235 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXOrder.h +++ b/samples/client/petstore/cpp-qt5/client/PFXOrder.h @@ -3,7 +3,6 @@ * 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 @@ -21,86 +20,75 @@ #include - #include #include -#include "PFXObject.h" #include "PFXEnum.h" - +#include "PFXObject.h" namespace test_namespace { -class PFXOrder: public PFXObject { +class PFXOrder : public PFXObject { public: PFXOrder(); PFXOrder(QString json); ~PFXOrder() override; - QString asJson () const override; + QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; - qint64 getId() const; void setId(const qint64 &id); - qint64 getPetId() const; void setPetId(const qint64 &pet_id); - qint32 getQuantity() const; void setQuantity(const qint32 &quantity); - QDateTime getShipDate() const; void setShipDate(const QDateTime &ship_date); - QString getStatus() const; void setStatus(const QString &status); - bool isComplete() const; void setComplete(const bool &complete); - - virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); - + qint64 id; bool m_id_isSet; bool m_id_isValid; - + qint64 pet_id; bool m_pet_id_isSet; bool m_pet_id_isValid; - + qint32 quantity; bool m_quantity_isSet; bool m_quantity_isValid; - + QDateTime ship_date; bool m_ship_date_isSet; bool m_ship_date_isValid; - + QString status; bool m_status_isSet; bool m_status_isValid; - + bool complete; bool m_complete_isSet; bool m_complete_isValid; - - }; +}; -} +} // namespace test_namespace Q_DECLARE_METATYPE(test_namespace::PFXOrder) diff --git a/samples/client/petstore/cpp-qt5/client/PFXPet.cpp b/samples/client/petstore/cpp-qt5/client/PFXPet.cpp index 955fc9166ac..1f124957497 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPet.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXPet.cpp @@ -3,20 +3,18 @@ * 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 "PFXPet.h" -#include -#include -#include #include +#include +#include +#include #include "PFXHelpers.h" @@ -31,188 +29,174 @@ PFXPet::PFXPet() { this->initializeModel(); } -PFXPet::~PFXPet() { +PFXPet::~PFXPet() {} -} +void PFXPet::initializeModel() { -void -PFXPet::initializeModel() { - m_id_isSet = false; m_id_isValid = false; - + m_category_isSet = false; m_category_isValid = false; - + m_name_isSet = false; m_name_isValid = false; - + m_photo_urls_isSet = false; m_photo_urls_isValid = false; - + m_tags_isSet = false; m_tags_isValid = false; - + m_status_isSet = false; m_status_isValid = false; - } -void -PFXPet::fromJson(QString jsonString) { - QByteArray array (jsonString.toStdString().c_str()); +void PFXPet::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } -void -PFXPet::fromJsonObject(QJsonObject json) { - +void PFXPet::fromJsonObject(QJsonObject json) { + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - + m_category_isValid = ::test_namespace::fromJsonValue(category, json[QString("category")]); m_category_isSet = !json[QString("category")].isNull() && m_category_isValid; - + m_name_isValid = ::test_namespace::fromJsonValue(name, json[QString("name")]); m_name_isSet = !json[QString("name")].isNull() && m_name_isValid; - + m_photo_urls_isValid = ::test_namespace::fromJsonValue(photo_urls, json[QString("photoUrls")]); m_photo_urls_isSet = !json[QString("photoUrls")].isNull() && m_photo_urls_isValid; - + m_tags_isValid = ::test_namespace::fromJsonValue(tags, json[QString("tags")]); m_tags_isSet = !json[QString("tags")].isNull() && m_tags_isValid; - + m_status_isValid = ::test_namespace::fromJsonValue(status, json[QString("status")]); m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; - } -QString -PFXPet::asJson () const { +QString PFXPet::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } -QJsonObject -PFXPet::asJsonObject() const { +QJsonObject PFXPet::asJsonObject() const { QJsonObject obj; - if(m_id_isSet){ + if (m_id_isSet) { obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } - if(category.isSet()){ + if (category.isSet()) { obj.insert(QString("category"), ::test_namespace::toJsonValue(category)); } - if(m_name_isSet){ + if (m_name_isSet) { obj.insert(QString("name"), ::test_namespace::toJsonValue(name)); } - - if(photo_urls.size() > 0){ + if (photo_urls.size() > 0) { obj.insert(QString("photoUrls"), ::test_namespace::toJsonValue(photo_urls)); - } - - if(tags.size() > 0){ + } + if (tags.size() > 0) { obj.insert(QString("tags"), ::test_namespace::toJsonValue(tags)); - } - if(m_status_isSet){ + } + if (m_status_isSet) { obj.insert(QString("status"), ::test_namespace::toJsonValue(status)); } return obj; } - -qint64 -PFXPet::getId() const { +qint64 PFXPet::getId() const { return id; } -void -PFXPet::setId(const qint64 &id) { +void PFXPet::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } - -PFXCategory -PFXPet::getCategory() const { +PFXCategory PFXPet::getCategory() const { return category; } -void -PFXPet::setCategory(const PFXCategory &category) { +void PFXPet::setCategory(const PFXCategory &category) { this->category = category; this->m_category_isSet = true; } - -QString -PFXPet::getName() const { +QString PFXPet::getName() const { return name; } -void -PFXPet::setName(const QString &name) { +void PFXPet::setName(const QString &name) { this->name = name; this->m_name_isSet = true; } - -QList -PFXPet::getPhotoUrls() const { +QList PFXPet::getPhotoUrls() const { return photo_urls; } -void -PFXPet::setPhotoUrls(const QList &photo_urls) { +void PFXPet::setPhotoUrls(const QList &photo_urls) { this->photo_urls = photo_urls; this->m_photo_urls_isSet = true; } - -QList -PFXPet::getTags() const { +QList PFXPet::getTags() const { return tags; } -void -PFXPet::setTags(const QList &tags) { +void PFXPet::setTags(const QList &tags) { this->tags = tags; this->m_tags_isSet = true; } - -QString -PFXPet::getStatus() const { +QString PFXPet::getStatus() const { return status; } -void -PFXPet::setStatus(const QString &status) { +void PFXPet::setStatus(const QString &status) { this->status = status; this->m_status_isSet = true; } -bool -PFXPet::isSet() const { +bool PFXPet::isSet() const { bool isObjectUpdated = false; - do{ - if(m_id_isSet){ isObjectUpdated = true; break;} - - if(category.isSet()){ isObjectUpdated = true; break;} - - if(m_name_isSet){ isObjectUpdated = true; break;} - - if(photo_urls.size() > 0){ isObjectUpdated = true; break;} - - if(tags.size() > 0){ isObjectUpdated = true; break;} - - if(m_status_isSet){ isObjectUpdated = true; break;} - }while(false); + do { + if (m_id_isSet) { + isObjectUpdated = true; + break; + } + + if (category.isSet()) { + isObjectUpdated = true; + break; + } + + if (m_name_isSet) { + isObjectUpdated = true; + break; + } + + if (photo_urls.size() > 0) { + isObjectUpdated = true; + break; + } + + if (tags.size() > 0) { + isObjectUpdated = true; + break; + } + + if (m_status_isSet) { + isObjectUpdated = true; + break; + } + } while (false); return isObjectUpdated; } -bool -PFXPet::isValid() const { +bool PFXPet::isValid() const { // only required properties are required for the object to be considered valid return m_name_isValid && m_photo_urls_isValid && true; } -} - +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXPet.h b/samples/client/petstore/cpp-qt5/client/PFXPet.h index ad5d035e995..4d20e3d8a5d 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPet.h +++ b/samples/client/petstore/cpp-qt5/client/PFXPet.h @@ -3,7 +3,6 @@ * 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 @@ -21,88 +20,77 @@ #include - #include "PFXCategory.h" #include "PFXTag.h" #include #include -#include "PFXObject.h" #include "PFXEnum.h" - +#include "PFXObject.h" namespace test_namespace { -class PFXPet: public PFXObject { +class PFXPet : public PFXObject { public: PFXPet(); PFXPet(QString json); ~PFXPet() override; - QString asJson () const override; + QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; - qint64 getId() const; void setId(const qint64 &id); - PFXCategory getCategory() const; void setCategory(const PFXCategory &category); - QString getName() const; void setName(const QString &name); - QList getPhotoUrls() const; void setPhotoUrls(const QList &photo_urls); - QList getTags() const; void setTags(const QList &tags); - QString getStatus() const; void setStatus(const QString &status); - - virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); - + qint64 id; bool m_id_isSet; bool m_id_isValid; - + PFXCategory category; bool m_category_isSet; bool m_category_isValid; - + QString name; bool m_name_isSet; bool m_name_isValid; - + QList photo_urls; bool m_photo_urls_isSet; bool m_photo_urls_isValid; - + QList tags; bool m_tags_isSet; bool m_tags_isValid; - + QString status; bool m_status_isSet; bool m_status_isValid; - - }; +}; -} +} // namespace test_namespace Q_DECLARE_METATYPE(test_namespace::PFXPet) diff --git a/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp index 0c03c3cd31c..9ac2f626458 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp @@ -3,7 +3,6 @@ * 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 @@ -18,86 +17,75 @@ namespace test_namespace { -PFXPetApi::PFXPetApi(const QString &scheme, const QString &host, int port, const QString& basePath, const int timeOut) : - _scheme(scheme), - _host(host), - _port(port), - _basePath(basePath), - _timeOut(timeOut) { -} +PFXPetApi::PFXPetApi(const QString &scheme, const QString &host, int port, const QString &basePath, const int timeOut) + : _scheme(scheme), + _host(host), + _port(port), + _basePath(basePath), + _timeOut(timeOut) {} PFXPetApi::~PFXPetApi() { } -void PFXPetApi::setScheme(const QString& scheme){ +void PFXPetApi::setScheme(const QString &scheme) { _scheme = scheme; } -void PFXPetApi::setHost(const QString& host){ +void PFXPetApi::setHost(const QString &host) { _host = host; } -void PFXPetApi::setPort(int port){ +void PFXPetApi::setPort(int port) { _port = port; } -void PFXPetApi::setBasePath(const QString& basePath){ +void PFXPetApi::setBasePath(const QString &basePath) { _basePath = basePath; } -void PFXPetApi::setTimeOut(const int timeOut){ +void PFXPetApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } -void PFXPetApi::setWorkingDirectory(const QString& path){ +void PFXPetApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } -void PFXPetApi::addHeaders(const QString& key, const QString& value){ +void PFXPetApi::addHeaders(const QString &key, const QString &value) { defaultHeaders.insert(key, value); } -void -PFXPetApi::addPet(const PFXPet& body) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/pet"); - +void PFXPetApi::addPet(const PFXPet &body) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/pet"); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); - - + QString output = body.asJson(); input.request_body.append(output); - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXPetApi::addPetCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::addPetCallback); worker->execute(&input); } -void -PFXPetApi::addPetCallback(PFXHttpRequestWorker * worker) { +void PFXPetApi::addPetCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -111,50 +99,41 @@ PFXPetApi::addPetCallback(PFXHttpRequestWorker * worker) { } } -void -PFXPetApi::deletePet(const qint64& pet_id, const QString& api_key) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/pet/{petId}"); +void PFXPetApi::deletePet(const qint64 &pet_id, const QString &api_key) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/pet/{petId}"); QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "DELETE"); - if (api_key != nullptr) { input.headers.insert("api_key", api_key); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXPetApi::deletePetCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::deletePetCallback); worker->execute(&input); } -void -PFXPetApi::deletePetCallback(PFXHttpRequestWorker * worker) { +void PFXPetApi::deletePetCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -168,92 +147,80 @@ PFXPetApi::deletePetCallback(PFXHttpRequestWorker * worker) { } } -void -PFXPetApi::findPetsByStatus(const QList& status) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/pet/findByStatus"); - +void PFXPetApi::findPetsByStatus(const QList &status) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/pet/findByStatus"); + if (status.size() > 0) { - if (QString("csv").indexOf("multi") == 0) { - foreach(QString t, status) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("status=").append(::test_namespace::toStringValue(t)); + if (QString("csv").indexOf("multi") == 0) { + foreach (QString t, status) { + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append("status=").append(::test_namespace::toStringValue(t)); + } + } else if (QString("csv").indexOf("ssv") == 0) { + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append("status="); + qint32 count = 0; + foreach (QString t, status) { + if (count > 0) { + fullPath.append(" "); + } + fullPath.append(::test_namespace::toStringValue(t)); + } + } else if (QString("csv").indexOf("tsv") == 0) { + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append("status="); + qint32 count = 0; + foreach (QString t, status) { + if (count > 0) { + fullPath.append("\t"); + } + fullPath.append(::test_namespace::toStringValue(t)); + } } - } - else if (QString("csv").indexOf("ssv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("status="); - qint32 count = 0; - foreach(QString t, status) { - if (count > 0) { - fullPath.append(" "); - } - fullPath.append(::test_namespace::toStringValue(t)); - } - } - else if (QString("csv").indexOf("tsv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("status="); - qint32 count = 0; - foreach(QString t, status) { - if (count > 0) { - fullPath.append("\t"); - } - fullPath.append(::test_namespace::toStringValue(t)); - } - } } - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXPetApi::findPetsByStatusCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByStatusCallback); worker->execute(&input); } -void -PFXPetApi::findPetsByStatusCallback(PFXHttpRequestWorker * worker) { +void PFXPetApi::findPetsByStatusCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } QList output; QString json(worker->response); - QByteArray array (json.toStdString().c_str()); + QByteArray array(json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonArray jsonArray = doc.array(); - foreach(QJsonValue obj, jsonArray) { + foreach (QJsonValue obj, jsonArray) { PFXPet val; ::test_namespace::fromJsonValue(val, obj); output.append(val); @@ -269,92 +236,80 @@ PFXPetApi::findPetsByStatusCallback(PFXHttpRequestWorker * worker) { } } -void -PFXPetApi::findPetsByTags(const QList& tags) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/pet/findByTags"); - +void PFXPetApi::findPetsByTags(const QList &tags) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/pet/findByTags"); + if (tags.size() > 0) { - if (QString("csv").indexOf("multi") == 0) { - foreach(QString t, tags) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("tags=").append(::test_namespace::toStringValue(t)); + if (QString("csv").indexOf("multi") == 0) { + foreach (QString t, tags) { + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append("tags=").append(::test_namespace::toStringValue(t)); + } + } else if (QString("csv").indexOf("ssv") == 0) { + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append("tags="); + qint32 count = 0; + foreach (QString t, tags) { + if (count > 0) { + fullPath.append(" "); + } + fullPath.append(::test_namespace::toStringValue(t)); + } + } else if (QString("csv").indexOf("tsv") == 0) { + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append("tags="); + qint32 count = 0; + foreach (QString t, tags) { + if (count > 0) { + fullPath.append("\t"); + } + fullPath.append(::test_namespace::toStringValue(t)); + } } - } - else if (QString("csv").indexOf("ssv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("tags="); - qint32 count = 0; - foreach(QString t, tags) { - if (count > 0) { - fullPath.append(" "); - } - fullPath.append(::test_namespace::toStringValue(t)); - } - } - else if (QString("csv").indexOf("tsv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("tags="); - qint32 count = 0; - foreach(QString t, tags) { - if (count > 0) { - fullPath.append("\t"); - } - fullPath.append(::test_namespace::toStringValue(t)); - } - } } - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXPetApi::findPetsByTagsCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByTagsCallback); worker->execute(&input); } -void -PFXPetApi::findPetsByTagsCallback(PFXHttpRequestWorker * worker) { +void PFXPetApi::findPetsByTagsCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } QList output; QString json(worker->response); - QByteArray array (json.toStdString().c_str()); + QByteArray array(json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonArray jsonArray = doc.array(); - foreach(QJsonValue obj, jsonArray) { + foreach (QJsonValue obj, jsonArray) { PFXPet val; ::test_namespace::fromJsonValue(val, obj); output.append(val); @@ -370,47 +325,37 @@ PFXPetApi::findPetsByTagsCallback(PFXHttpRequestWorker * worker) { } } -void -PFXPetApi::getPetById(const qint64& pet_id) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/pet/{petId}"); +void PFXPetApi::getPetById(const qint64 &pet_id) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/pet/{petId}"); QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXPetApi::getPetByIdCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::getPetByIdCallback); worker->execute(&input); } -void -PFXPetApi::getPetByIdCallback(PFXHttpRequestWorker * worker) { +void PFXPetApi::getPetByIdCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } PFXPet output(QString(worker->response)); @@ -425,47 +370,37 @@ PFXPetApi::getPetByIdCallback(PFXHttpRequestWorker * worker) { } } -void -PFXPetApi::updatePet(const PFXPet& body) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/pet"); - +void PFXPetApi::updatePet(const PFXPet &body) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/pet"); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "PUT"); - - + QString output = body.asJson(); input.request_body.append(output); - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXPetApi::updatePetCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetCallback); worker->execute(&input); } -void -PFXPetApi::updatePetCallback(PFXHttpRequestWorker * worker) { +void PFXPetApi::updatePetCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -479,49 +414,39 @@ PFXPetApi::updatePetCallback(PFXHttpRequestWorker * worker) { } } -void -PFXPetApi::updatePetWithForm(const qint64& pet_id, const QString& name, const QString& status) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/pet/{petId}"); +void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const QString &name, const QString &status) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/pet/{petId}"); QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); - + input.add_var("name", ::test_namespace::toStringValue(name)); input.add_var("status", ::test_namespace::toStringValue(status)); + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXPetApi::updatePetWithFormCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetWithFormCallback); worker->execute(&input); } -void -PFXPetApi::updatePetWithFormCallback(PFXHttpRequestWorker * worker) { +void PFXPetApi::updatePetWithFormCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -535,49 +460,39 @@ PFXPetApi::updatePetWithFormCallback(PFXHttpRequestWorker * worker) { } } -void -PFXPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata, const PFXHttpFileElement& file) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/pet/{petId}/uploadImage"); +void PFXPetApi::uploadFile(const qint64 &pet_id, const QString &additional_metadata, const PFXHttpFileElement &file) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/pet/{petId}/uploadImage"); QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); - + input.add_var("additionalMetadata", ::test_namespace::toStringValue(additional_metadata)); input.add_file("file", file.local_filename, file.request_filename, file.mime_type); + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXPetApi::uploadFileCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::uploadFileCallback); worker->execute(&input); } -void -PFXPetApi::uploadFileCallback(PFXHttpRequestWorker * worker) { +void PFXPetApi::uploadFileCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } PFXApiResponse output(QString(worker->response)); @@ -592,5 +507,4 @@ PFXPetApi::uploadFileCallback(PFXHttpRequestWorker * worker) { } } - -} +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXPetApi.h b/samples/client/petstore/cpp-qt5/client/PFXPetApi.h index 1de448152b1..f55675845c1 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPetApi.h +++ b/samples/client/petstore/cpp-qt5/client/PFXPetApi.h @@ -3,7 +3,6 @@ * 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 @@ -24,30 +23,30 @@ namespace test_namespace { -class PFXPetApi: public QObject { +class PFXPetApi : public QObject { Q_OBJECT public: - PFXPetApi(const QString &scheme = "http", const QString &host = "petstore.swagger.io", int port = 0, const QString& basePath = "/v2", const int timeOut = 0); + PFXPetApi(const QString &scheme = "http", const QString &host = "petstore.swagger.io", int port = 0, const QString &basePath = "/v2", const int timeOut = 0); ~PFXPetApi(); void setScheme(const QString &scheme); void setHost(const QString &host); void setPort(int port); - void setBasePath(const QString& basePath); + void setBasePath(const QString &basePath); void setTimeOut(const int timeOut); - void setWorkingDirectory(const QString& path); - void addHeaders(const QString& key, const QString& value); + void setWorkingDirectory(const QString &path); + void addHeaders(const QString &key, const QString &value); + + void addPet(const PFXPet &body); + void deletePet(const qint64 &pet_id, const QString &api_key); + void findPetsByStatus(const QList &status); + void findPetsByTags(const QList &tags); + void getPetById(const qint64 &pet_id); + void updatePet(const PFXPet &body); + void updatePetWithForm(const qint64 &pet_id, const QString &name, const QString &status); + void uploadFile(const qint64 &pet_id, const QString &additional_metadata, const PFXHttpFileElement &file); - void addPet(const PFXPet& body); - void deletePet(const qint64& pet_id, const QString& api_key); - void findPetsByStatus(const QList& status); - void findPetsByTags(const QList& tags); - void getPetById(const qint64& pet_id); - void updatePet(const PFXPet& body); - void updatePetWithForm(const qint64& pet_id, const QString& name, const QString& status); - void uploadFile(const qint64& pet_id, const QString& additional_metadata, const PFXHttpFileElement& file); - private: QString _scheme, _host; int _port; @@ -55,16 +54,18 @@ private: int _timeOut; QString _workingDirectory; QMap defaultHeaders; - void addPetCallback (PFXHttpRequestWorker * worker); - void deletePetCallback (PFXHttpRequestWorker * worker); - void findPetsByStatusCallback (PFXHttpRequestWorker * worker); - void findPetsByTagsCallback (PFXHttpRequestWorker * worker); - void getPetByIdCallback (PFXHttpRequestWorker * worker); - void updatePetCallback (PFXHttpRequestWorker * worker); - void updatePetWithFormCallback (PFXHttpRequestWorker * worker); - void uploadFileCallback (PFXHttpRequestWorker * worker); - + + void addPetCallback(PFXHttpRequestWorker *worker); + void deletePetCallback(PFXHttpRequestWorker *worker); + void findPetsByStatusCallback(PFXHttpRequestWorker *worker); + void findPetsByTagsCallback(PFXHttpRequestWorker *worker); + void getPetByIdCallback(PFXHttpRequestWorker *worker); + void updatePetCallback(PFXHttpRequestWorker *worker); + void updatePetWithFormCallback(PFXHttpRequestWorker *worker); + void uploadFileCallback(PFXHttpRequestWorker *worker); + signals: + void addPetSignal(); void deletePetSignal(); void findPetsByStatusSignal(QList summary); @@ -73,16 +74,16 @@ signals: void updatePetSignal(); void updatePetWithFormSignal(); void uploadFileSignal(PFXApiResponse summary); - - void addPetSignalFull(PFXHttpRequestWorker* worker); - void deletePetSignalFull(PFXHttpRequestWorker* worker); - void findPetsByStatusSignalFull(PFXHttpRequestWorker* worker, QList summary); - void findPetsByTagsSignalFull(PFXHttpRequestWorker* worker, QList summary); - void getPetByIdSignalFull(PFXHttpRequestWorker* worker, PFXPet summary); - void updatePetSignalFull(PFXHttpRequestWorker* worker); - void updatePetWithFormSignalFull(PFXHttpRequestWorker* worker); - void uploadFileSignalFull(PFXHttpRequestWorker* worker, PFXApiResponse summary); - + + void addPetSignalFull(PFXHttpRequestWorker *worker); + void deletePetSignalFull(PFXHttpRequestWorker *worker); + void findPetsByStatusSignalFull(PFXHttpRequestWorker *worker, QList summary); + void findPetsByTagsSignalFull(PFXHttpRequestWorker *worker, QList summary); + void getPetByIdSignalFull(PFXHttpRequestWorker *worker, PFXPet summary); + void updatePetSignalFull(PFXHttpRequestWorker *worker); + void updatePetWithFormSignalFull(PFXHttpRequestWorker *worker); + void uploadFileSignalFull(PFXHttpRequestWorker *worker, PFXApiResponse 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); @@ -91,17 +92,16 @@ signals: void updatePetSignalE(QNetworkReply::NetworkError error_type, QString error_str); void updatePetWithFormSignalE(QNetworkReply::NetworkError error_type, QString error_str); void uploadFileSignalE(PFXApiResponse summary, QNetworkReply::NetworkError error_type, QString error_str); - - void addPetSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void deletePetSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void findPetsByStatusSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void findPetsByTagsSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void getPetByIdSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void updatePetSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void updatePetWithFormSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void uploadFileSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - + + void addPetSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void deletePetSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByStatusSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByTagsSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void getPetByIdSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void updatePetSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void updatePetWithFormSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void uploadFileSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); }; -} +} // namespace test_namespace #endif diff --git a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp index df62ceb15b1..f16902079de 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp @@ -3,7 +3,6 @@ * 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 @@ -18,86 +17,75 @@ namespace test_namespace { -PFXStoreApi::PFXStoreApi(const QString &scheme, const QString &host, int port, const QString& basePath, const int timeOut) : - _scheme(scheme), - _host(host), - _port(port), - _basePath(basePath), - _timeOut(timeOut) { -} +PFXStoreApi::PFXStoreApi(const QString &scheme, const QString &host, int port, const QString &basePath, const int timeOut) + : _scheme(scheme), + _host(host), + _port(port), + _basePath(basePath), + _timeOut(timeOut) {} PFXStoreApi::~PFXStoreApi() { } -void PFXStoreApi::setScheme(const QString& scheme){ +void PFXStoreApi::setScheme(const QString &scheme) { _scheme = scheme; } -void PFXStoreApi::setHost(const QString& host){ +void PFXStoreApi::setHost(const QString &host) { _host = host; } -void PFXStoreApi::setPort(int port){ +void PFXStoreApi::setPort(int port) { _port = port; } -void PFXStoreApi::setBasePath(const QString& basePath){ +void PFXStoreApi::setBasePath(const QString &basePath) { _basePath = basePath; } -void PFXStoreApi::setTimeOut(const int timeOut){ +void PFXStoreApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } -void PFXStoreApi::setWorkingDirectory(const QString& path){ +void PFXStoreApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } -void PFXStoreApi::addHeaders(const QString& key, const QString& value){ +void PFXStoreApi::addHeaders(const QString &key, const QString &value) { defaultHeaders.insert(key, value); } -void -PFXStoreApi::deleteOrder(const QString& order_id) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/store/order/{orderId}"); +void PFXStoreApi::deleteOrder(const QString &order_id) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/store/order/{orderId}"); QString order_idPathParam("{"); order_idPathParam.append("orderId").append("}"); fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(order_id))); - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "DELETE"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXStoreApi::deleteOrderCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::deleteOrderCallback); worker->execute(&input); } -void -PFXStoreApi::deleteOrderCallback(PFXHttpRequestWorker * worker) { +void PFXStoreApi::deleteOrderCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -111,52 +99,42 @@ PFXStoreApi::deleteOrderCallback(PFXHttpRequestWorker * worker) { } } -void -PFXStoreApi::getInventory() { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/store/inventory"); - +void PFXStoreApi::getInventory() { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/store/inventory"); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXStoreApi::getInventoryCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getInventoryCallback); worker->execute(&input); } -void -PFXStoreApi::getInventoryCallback(PFXHttpRequestWorker * worker) { +void PFXStoreApi::getInventoryCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } QMap output; QString json(worker->response); - QByteArray array (json.toStdString().c_str()); + QByteArray array(json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject obj = doc.object(); - foreach(QString key, obj.keys()) { + foreach (QString key, obj.keys()) { qint32 val; ::test_namespace::fromJsonValue(val, obj[key]); output.insert(key, val); @@ -172,47 +150,37 @@ PFXStoreApi::getInventoryCallback(PFXHttpRequestWorker * worker) { } } -void -PFXStoreApi::getOrderById(const qint64& order_id) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/store/order/{orderId}"); +void PFXStoreApi::getOrderById(const qint64 &order_id) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/store/order/{orderId}"); QString order_idPathParam("{"); order_idPathParam.append("orderId").append("}"); fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(order_id))); - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXStoreApi::getOrderByIdCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getOrderByIdCallback); worker->execute(&input); } -void -PFXStoreApi::getOrderByIdCallback(PFXHttpRequestWorker * worker) { +void PFXStoreApi::getOrderByIdCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } PFXOrder output(QString(worker->response)); @@ -227,47 +195,37 @@ PFXStoreApi::getOrderByIdCallback(PFXHttpRequestWorker * worker) { } } -void -PFXStoreApi::placeOrder(const PFXOrder& body) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/store/order"); - +void PFXStoreApi::placeOrder(const PFXOrder &body) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/store/order"); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); - - + QString output = body.asJson(); input.request_body.append(output); - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXStoreApi::placeOrderCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::placeOrderCallback); worker->execute(&input); } -void -PFXStoreApi::placeOrderCallback(PFXHttpRequestWorker * worker) { +void PFXStoreApi::placeOrderCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } PFXOrder output(QString(worker->response)); @@ -282,5 +240,4 @@ PFXStoreApi::placeOrderCallback(PFXHttpRequestWorker * worker) { } } - -} +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h index 59f4dfb5faa..d0dec36dad0 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h +++ b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h @@ -3,7 +3,6 @@ * 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 @@ -23,26 +22,26 @@ namespace test_namespace { -class PFXStoreApi: public QObject { +class PFXStoreApi : public QObject { Q_OBJECT public: - PFXStoreApi(const QString &scheme = "http", const QString &host = "petstore.swagger.io", int port = 0, const QString& basePath = "/v2", const int timeOut = 0); + PFXStoreApi(const QString &scheme = "http", const QString &host = "petstore.swagger.io", int port = 0, const QString &basePath = "/v2", const int timeOut = 0); ~PFXStoreApi(); void setScheme(const QString &scheme); void setHost(const QString &host); void setPort(int port); - void setBasePath(const QString& basePath); + void setBasePath(const QString &basePath); void setTimeOut(const int timeOut); - void setWorkingDirectory(const QString& path); - void addHeaders(const QString& key, const QString& value); + void setWorkingDirectory(const QString &path); + void addHeaders(const QString &key, const QString &value); - void deleteOrder(const QString& order_id); + void deleteOrder(const QString &order_id); void getInventory(); - void getOrderById(const qint64& order_id); - void placeOrder(const PFXOrder& body); - + void getOrderById(const qint64 &order_id); + void placeOrder(const PFXOrder &body); + private: QString _scheme, _host; int _port; @@ -50,33 +49,34 @@ private: int _timeOut; QString _workingDirectory; QMap defaultHeaders; - void deleteOrderCallback (PFXHttpRequestWorker * worker); - void getInventoryCallback (PFXHttpRequestWorker * worker); - void getOrderByIdCallback (PFXHttpRequestWorker * worker); - void placeOrderCallback (PFXHttpRequestWorker * worker); - + + void deleteOrderCallback(PFXHttpRequestWorker *worker); + void getInventoryCallback(PFXHttpRequestWorker *worker); + void getOrderByIdCallback(PFXHttpRequestWorker *worker); + void placeOrderCallback(PFXHttpRequestWorker *worker); + signals: + void deleteOrderSignal(); void getInventorySignal(QMap summary); void getOrderByIdSignal(PFXOrder summary); void placeOrderSignal(PFXOrder summary); - - void deleteOrderSignalFull(PFXHttpRequestWorker* worker); - void getInventorySignalFull(PFXHttpRequestWorker* worker, QMap summary); - void getOrderByIdSignalFull(PFXHttpRequestWorker* worker, PFXOrder summary); - void placeOrderSignalFull(PFXHttpRequestWorker* worker, PFXOrder summary); - + + void deleteOrderSignalFull(PFXHttpRequestWorker *worker); + void getInventorySignalFull(PFXHttpRequestWorker *worker, QMap summary); + void getOrderByIdSignalFull(PFXHttpRequestWorker *worker, PFXOrder summary); + void placeOrderSignalFull(PFXHttpRequestWorker *worker, PFXOrder summary); + void deleteOrderSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getInventorySignalE(QMap summary, QNetworkReply::NetworkError error_type, QString error_str); void getOrderByIdSignalE(PFXOrder summary, QNetworkReply::NetworkError error_type, QString error_str); void placeOrderSignalE(PFXOrder summary, QNetworkReply::NetworkError error_type, QString error_str); - - void deleteOrderSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void getInventorySignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void getOrderByIdSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void placeOrderSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - + + void deleteOrderSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void getInventorySignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void getOrderByIdSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void placeOrderSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); }; -} +} // namespace test_namespace #endif diff --git a/samples/client/petstore/cpp-qt5/client/PFXTag.cpp b/samples/client/petstore/cpp-qt5/client/PFXTag.cpp index b4fa9007879..4a046506c6b 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXTag.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXTag.cpp @@ -3,20 +3,18 @@ * 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 "PFXTag.h" -#include -#include -#include #include +#include +#include +#include #include "PFXHelpers.h" @@ -31,98 +29,86 @@ PFXTag::PFXTag() { this->initializeModel(); } -PFXTag::~PFXTag() { +PFXTag::~PFXTag() {} -} +void PFXTag::initializeModel() { -void -PFXTag::initializeModel() { - m_id_isSet = false; m_id_isValid = false; - + m_name_isSet = false; m_name_isValid = false; - } -void -PFXTag::fromJson(QString jsonString) { - QByteArray array (jsonString.toStdString().c_str()); +void PFXTag::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } -void -PFXTag::fromJsonObject(QJsonObject json) { - +void PFXTag::fromJsonObject(QJsonObject json) { + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - + m_name_isValid = ::test_namespace::fromJsonValue(name, json[QString("name")]); m_name_isSet = !json[QString("name")].isNull() && m_name_isValid; - } -QString -PFXTag::asJson () const { +QString PFXTag::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } -QJsonObject -PFXTag::asJsonObject() const { +QJsonObject PFXTag::asJsonObject() const { QJsonObject obj; - if(m_id_isSet){ + if (m_id_isSet) { obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } - if(m_name_isSet){ + if (m_name_isSet) { obj.insert(QString("name"), ::test_namespace::toJsonValue(name)); } return obj; } - -qint64 -PFXTag::getId() const { +qint64 PFXTag::getId() const { return id; } -void -PFXTag::setId(const qint64 &id) { +void PFXTag::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } - -QString -PFXTag::getName() const { +QString PFXTag::getName() const { return name; } -void -PFXTag::setName(const QString &name) { +void PFXTag::setName(const QString &name) { this->name = name; this->m_name_isSet = true; } -bool -PFXTag::isSet() const { +bool PFXTag::isSet() const { bool isObjectUpdated = false; - do{ - if(m_id_isSet){ isObjectUpdated = true; break;} - - if(m_name_isSet){ isObjectUpdated = true; break;} - }while(false); + do { + if (m_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_name_isSet) { + isObjectUpdated = true; + break; + } + } while (false); return isObjectUpdated; } -bool -PFXTag::isValid() const { +bool PFXTag::isValid() const { // only required properties are required for the object to be considered valid return true; } -} - +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXTag.h b/samples/client/petstore/cpp-qt5/client/PFXTag.h index 0ac8fe37085..6b80e1312ef 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXTag.h +++ b/samples/client/petstore/cpp-qt5/client/PFXTag.h @@ -3,7 +3,6 @@ * 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 @@ -21,53 +20,46 @@ #include - #include -#include "PFXObject.h" #include "PFXEnum.h" - +#include "PFXObject.h" namespace test_namespace { -class PFXTag: public PFXObject { +class PFXTag : public PFXObject { public: PFXTag(); PFXTag(QString json); ~PFXTag() override; - QString asJson () const override; + QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; - qint64 getId() const; void setId(const qint64 &id); - QString getName() const; void setName(const QString &name); - - virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); - + qint64 id; bool m_id_isSet; bool m_id_isValid; - + QString name; bool m_name_isSet; bool m_name_isValid; - - }; +}; -} +} // namespace test_namespace Q_DECLARE_METATYPE(test_namespace::PFXTag) diff --git a/samples/client/petstore/cpp-qt5/client/PFXUser.cpp b/samples/client/petstore/cpp-qt5/client/PFXUser.cpp index d77213bfd86..3a8e4eef1c7 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXUser.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXUser.cpp @@ -3,20 +3,18 @@ * 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 "PFXUser.h" -#include -#include -#include #include +#include +#include +#include #include "PFXHelpers.h" @@ -31,230 +29,218 @@ PFXUser::PFXUser() { this->initializeModel(); } -PFXUser::~PFXUser() { +PFXUser::~PFXUser() {} -} +void PFXUser::initializeModel() { -void -PFXUser::initializeModel() { - m_id_isSet = false; m_id_isValid = false; - + m_username_isSet = false; m_username_isValid = false; - + m_first_name_isSet = false; m_first_name_isValid = false; - + m_last_name_isSet = false; m_last_name_isValid = false; - + m_email_isSet = false; m_email_isValid = false; - + m_password_isSet = false; m_password_isValid = false; - + m_phone_isSet = false; m_phone_isValid = false; - + m_user_status_isSet = false; m_user_status_isValid = false; - } -void -PFXUser::fromJson(QString jsonString) { - QByteArray array (jsonString.toStdString().c_str()); +void PFXUser::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } -void -PFXUser::fromJsonObject(QJsonObject json) { - +void PFXUser::fromJsonObject(QJsonObject json) { + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - + m_username_isValid = ::test_namespace::fromJsonValue(username, json[QString("username")]); m_username_isSet = !json[QString("username")].isNull() && m_username_isValid; - + m_first_name_isValid = ::test_namespace::fromJsonValue(first_name, json[QString("firstName")]); m_first_name_isSet = !json[QString("firstName")].isNull() && m_first_name_isValid; - + m_last_name_isValid = ::test_namespace::fromJsonValue(last_name, json[QString("lastName")]); m_last_name_isSet = !json[QString("lastName")].isNull() && m_last_name_isValid; - + m_email_isValid = ::test_namespace::fromJsonValue(email, json[QString("email")]); m_email_isSet = !json[QString("email")].isNull() && m_email_isValid; - + m_password_isValid = ::test_namespace::fromJsonValue(password, json[QString("password")]); m_password_isSet = !json[QString("password")].isNull() && m_password_isValid; - + m_phone_isValid = ::test_namespace::fromJsonValue(phone, json[QString("phone")]); m_phone_isSet = !json[QString("phone")].isNull() && m_phone_isValid; - + m_user_status_isValid = ::test_namespace::fromJsonValue(user_status, json[QString("userStatus")]); m_user_status_isSet = !json[QString("userStatus")].isNull() && m_user_status_isValid; - } -QString -PFXUser::asJson () const { +QString PFXUser::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } -QJsonObject -PFXUser::asJsonObject() const { +QJsonObject PFXUser::asJsonObject() const { QJsonObject obj; - if(m_id_isSet){ + if (m_id_isSet) { obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } - if(m_username_isSet){ + if (m_username_isSet) { obj.insert(QString("username"), ::test_namespace::toJsonValue(username)); } - if(m_first_name_isSet){ + if (m_first_name_isSet) { obj.insert(QString("firstName"), ::test_namespace::toJsonValue(first_name)); } - if(m_last_name_isSet){ + if (m_last_name_isSet) { obj.insert(QString("lastName"), ::test_namespace::toJsonValue(last_name)); } - if(m_email_isSet){ + if (m_email_isSet) { obj.insert(QString("email"), ::test_namespace::toJsonValue(email)); } - if(m_password_isSet){ + if (m_password_isSet) { obj.insert(QString("password"), ::test_namespace::toJsonValue(password)); } - if(m_phone_isSet){ + if (m_phone_isSet) { obj.insert(QString("phone"), ::test_namespace::toJsonValue(phone)); } - if(m_user_status_isSet){ + if (m_user_status_isSet) { obj.insert(QString("userStatus"), ::test_namespace::toJsonValue(user_status)); } return obj; } - -qint64 -PFXUser::getId() const { +qint64 PFXUser::getId() const { return id; } -void -PFXUser::setId(const qint64 &id) { +void PFXUser::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } - -QString -PFXUser::getUsername() const { +QString PFXUser::getUsername() const { return username; } -void -PFXUser::setUsername(const QString &username) { +void PFXUser::setUsername(const QString &username) { this->username = username; this->m_username_isSet = true; } - -QString -PFXUser::getFirstName() const { +QString PFXUser::getFirstName() const { return first_name; } -void -PFXUser::setFirstName(const QString &first_name) { +void PFXUser::setFirstName(const QString &first_name) { this->first_name = first_name; this->m_first_name_isSet = true; } - -QString -PFXUser::getLastName() const { +QString PFXUser::getLastName() const { return last_name; } -void -PFXUser::setLastName(const QString &last_name) { +void PFXUser::setLastName(const QString &last_name) { this->last_name = last_name; this->m_last_name_isSet = true; } - -QString -PFXUser::getEmail() const { +QString PFXUser::getEmail() const { return email; } -void -PFXUser::setEmail(const QString &email) { +void PFXUser::setEmail(const QString &email) { this->email = email; this->m_email_isSet = true; } - -QString -PFXUser::getPassword() const { +QString PFXUser::getPassword() const { return password; } -void -PFXUser::setPassword(const QString &password) { +void PFXUser::setPassword(const QString &password) { this->password = password; this->m_password_isSet = true; } - -QString -PFXUser::getPhone() const { +QString PFXUser::getPhone() const { return phone; } -void -PFXUser::setPhone(const QString &phone) { +void PFXUser::setPhone(const QString &phone) { this->phone = phone; this->m_phone_isSet = true; } - -qint32 -PFXUser::getUserStatus() const { +qint32 PFXUser::getUserStatus() const { return user_status; } -void -PFXUser::setUserStatus(const qint32 &user_status) { +void PFXUser::setUserStatus(const qint32 &user_status) { this->user_status = user_status; this->m_user_status_isSet = true; } -bool -PFXUser::isSet() const { +bool PFXUser::isSet() const { bool isObjectUpdated = false; - do{ - if(m_id_isSet){ isObjectUpdated = true; break;} - - if(m_username_isSet){ isObjectUpdated = true; break;} - - if(m_first_name_isSet){ isObjectUpdated = true; break;} - - if(m_last_name_isSet){ isObjectUpdated = true; break;} - - if(m_email_isSet){ isObjectUpdated = true; break;} - - if(m_password_isSet){ isObjectUpdated = true; break;} - - if(m_phone_isSet){ isObjectUpdated = true; break;} - - if(m_user_status_isSet){ isObjectUpdated = true; break;} - }while(false); + do { + if (m_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_username_isSet) { + isObjectUpdated = true; + break; + } + + if (m_first_name_isSet) { + isObjectUpdated = true; + break; + } + + if (m_last_name_isSet) { + isObjectUpdated = true; + break; + } + + if (m_email_isSet) { + isObjectUpdated = true; + break; + } + + if (m_password_isSet) { + isObjectUpdated = true; + break; + } + + if (m_phone_isSet) { + isObjectUpdated = true; + break; + } + + if (m_user_status_isSet) { + isObjectUpdated = true; + break; + } + } while (false); return isObjectUpdated; } -bool -PFXUser::isValid() const { +bool PFXUser::isValid() const { // only required properties are required for the object to be considered valid return true; } -} - +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXUser.h b/samples/client/petstore/cpp-qt5/client/PFXUser.h index bfda4d5e4e0..df23a4734c2 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXUser.h +++ b/samples/client/petstore/cpp-qt5/client/PFXUser.h @@ -3,7 +3,6 @@ * 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 @@ -21,101 +20,88 @@ #include - #include -#include "PFXObject.h" #include "PFXEnum.h" - +#include "PFXObject.h" namespace test_namespace { -class PFXUser: public PFXObject { +class PFXUser : public PFXObject { public: PFXUser(); PFXUser(QString json); ~PFXUser() override; - QString asJson () const override; + QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; - qint64 getId() const; void setId(const qint64 &id); - QString getUsername() const; void setUsername(const QString &username); - QString getFirstName() const; void setFirstName(const QString &first_name); - QString getLastName() const; void setLastName(const QString &last_name); - QString getEmail() const; void setEmail(const QString &email); - QString getPassword() const; void setPassword(const QString &password); - QString getPhone() const; void setPhone(const QString &phone); - qint32 getUserStatus() const; void setUserStatus(const qint32 &user_status); - - virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); - + qint64 id; bool m_id_isSet; bool m_id_isValid; - + QString username; bool m_username_isSet; bool m_username_isValid; - + QString first_name; bool m_first_name_isSet; bool m_first_name_isValid; - + QString last_name; bool m_last_name_isSet; bool m_last_name_isValid; - + QString email; bool m_email_isSet; bool m_email_isValid; - + QString password; bool m_password_isSet; bool m_password_isValid; - + QString phone; bool m_phone_isSet; bool m_phone_isValid; - + qint32 user_status; bool m_user_status_isSet; bool m_user_status_isValid; - - }; +}; -} +} // namespace test_namespace Q_DECLARE_METATYPE(test_namespace::PFXUser) diff --git a/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp index 07c5edb9b90..b2d2b6aa2fe 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp @@ -3,7 +3,6 @@ * 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 @@ -18,86 +17,75 @@ namespace test_namespace { -PFXUserApi::PFXUserApi(const QString &scheme, const QString &host, int port, const QString& basePath, const int timeOut) : - _scheme(scheme), - _host(host), - _port(port), - _basePath(basePath), - _timeOut(timeOut) { -} +PFXUserApi::PFXUserApi(const QString &scheme, const QString &host, int port, const QString &basePath, const int timeOut) + : _scheme(scheme), + _host(host), + _port(port), + _basePath(basePath), + _timeOut(timeOut) {} PFXUserApi::~PFXUserApi() { } -void PFXUserApi::setScheme(const QString& scheme){ +void PFXUserApi::setScheme(const QString &scheme) { _scheme = scheme; } -void PFXUserApi::setHost(const QString& host){ +void PFXUserApi::setHost(const QString &host) { _host = host; } -void PFXUserApi::setPort(int port){ +void PFXUserApi::setPort(int port) { _port = port; } -void PFXUserApi::setBasePath(const QString& basePath){ +void PFXUserApi::setBasePath(const QString &basePath) { _basePath = basePath; } -void PFXUserApi::setTimeOut(const int timeOut){ +void PFXUserApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } -void PFXUserApi::setWorkingDirectory(const QString& path){ +void PFXUserApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } -void PFXUserApi::addHeaders(const QString& key, const QString& value){ +void PFXUserApi::addHeaders(const QString &key, const QString &value) { defaultHeaders.insert(key, value); } -void -PFXUserApi::createUser(const PFXUser& body) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/user"); - +void PFXUserApi::createUser(const PFXUser &body) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/user"); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); - - + QString output = body.asJson(); input.request_body.append(output); - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXUserApi::createUserCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUserCallback); worker->execute(&input); } -void -PFXUserApi::createUserCallback(PFXHttpRequestWorker * worker) { +void PFXUserApi::createUserCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -111,48 +99,38 @@ PFXUserApi::createUserCallback(PFXHttpRequestWorker * worker) { } } -void -PFXUserApi::createUsersWithArrayInput(const QList& body) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/user/createWithArray"); - +void PFXUserApi::createUsersWithArrayInput(const QList &body) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/user/createWithArray"); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); - - + QJsonDocument doc(::test_namespace::toJsonValue(body).toArray()); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXUserApi::createUsersWithArrayInputCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithArrayInputCallback); worker->execute(&input); } -void -PFXUserApi::createUsersWithArrayInputCallback(PFXHttpRequestWorker * worker) { +void PFXUserApi::createUsersWithArrayInputCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -166,48 +144,38 @@ PFXUserApi::createUsersWithArrayInputCallback(PFXHttpRequestWorker * worker) { } } -void -PFXUserApi::createUsersWithListInput(const QList& body) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/user/createWithList"); - +void PFXUserApi::createUsersWithListInput(const QList &body) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/user/createWithList"); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); - - + QJsonDocument doc(::test_namespace::toJsonValue(body).toArray()); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXUserApi::createUsersWithListInputCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithListInputCallback); worker->execute(&input); } -void -PFXUserApi::createUsersWithListInputCallback(PFXHttpRequestWorker * worker) { +void PFXUserApi::createUsersWithListInputCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -221,47 +189,37 @@ PFXUserApi::createUsersWithListInputCallback(PFXHttpRequestWorker * worker) { } } -void -PFXUserApi::deleteUser(const QString& username) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/user/{username}"); +void PFXUserApi::deleteUser(const QString &username) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/user/{username}"); QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "DELETE"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXUserApi::deleteUserCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::deleteUserCallback); worker->execute(&input); } -void -PFXUserApi::deleteUserCallback(PFXHttpRequestWorker * worker) { +void PFXUserApi::deleteUserCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -275,47 +233,37 @@ PFXUserApi::deleteUserCallback(PFXHttpRequestWorker * worker) { } } -void -PFXUserApi::getUserByName(const QString& username) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/user/{username}"); +void PFXUserApi::getUserByName(const QString &username) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/user/{username}"); QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXUserApi::getUserByNameCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::getUserByNameCallback); worker->execute(&input); } -void -PFXUserApi::getUserByNameCallback(PFXHttpRequestWorker * worker) { +void PFXUserApi::getUserByNameCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } PFXUser output(QString(worker->response)); @@ -330,60 +278,46 @@ PFXUserApi::getUserByNameCallback(PFXHttpRequestWorker * worker) { } } -void -PFXUserApi::loginUser(const QString& username, const QString& password) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/user/login"); - +void PFXUserApi::loginUser(const QString &username, const QString &password) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/user/login"); + if (fullPath.indexOf("?") > 0) - fullPath.append("&"); + fullPath.append("&"); else - fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("username")) - .append("=") - .append(QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - + fullPath.append("?"); + fullPath.append(QUrl::toPercentEncoding("username")).append("=").append(QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); + if (fullPath.indexOf("?") > 0) - fullPath.append("&"); + fullPath.append("&"); else - fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("password")) - .append("=") - .append(QUrl::toPercentEncoding(::test_namespace::toStringValue(password))); - + fullPath.append("?"); + fullPath.append(QUrl::toPercentEncoding("password")).append("=").append(QUrl::toPercentEncoding(::test_namespace::toStringValue(password))); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXUserApi::loginUserCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::loginUserCallback); worker->execute(&input); } -void -PFXUserApi::loginUserCallback(PFXHttpRequestWorker * worker) { +void PFXUserApi::loginUserCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } QString output; @@ -399,44 +333,34 @@ PFXUserApi::loginUserCallback(PFXHttpRequestWorker * worker) { } } -void -PFXUserApi::logoutUser() { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/user/logout"); - +void PFXUserApi::logoutUser() { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/user/logout"); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); - + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXUserApi::logoutUserCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::logoutUserCallback); worker->execute(&input); } -void -PFXUserApi::logoutUserCallback(PFXHttpRequestWorker * worker) { +void PFXUserApi::logoutUserCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -450,50 +374,40 @@ PFXUserApi::logoutUserCallback(PFXHttpRequestWorker * worker) { } } -void -PFXUserApi::updateUser(const QString& username, const PFXUser& body) { - QString fullPath = QString("%0://%1%2%3%4") - .arg(_scheme) - .arg(_host) - .arg(_port ? ":" + QString::number(_port) : "") - .arg(_basePath) - .arg("/user/{username}"); +void PFXUserApi::updateUser(const QString &username, const PFXUser &body) { + QString fullPath = QString("%1://%2%3%4%5") + .arg(_scheme) + .arg(_host) + .arg(_port ? ":" + QString::number(_port) : "") + .arg(_basePath) + .arg("/user/{username}"); QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "PUT"); - - + QString output = body.asJson(); input.request_body.append(output); - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } + foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } - connect(worker, - &PFXHttpRequestWorker::on_execution_finished, - this, - &PFXUserApi::updateUserCallback); + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::updateUserCallback); worker->execute(&input); } -void -PFXUserApi::updateUserCallback(PFXHttpRequestWorker * worker) { +void PFXUserApi::updateUserCallback(PFXHttpRequestWorker *worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { + } else { msg = "Error: " + worker->error_str; } worker->deleteLater(); @@ -507,5 +421,4 @@ PFXUserApi::updateUserCallback(PFXHttpRequestWorker * worker) { } } - -} +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXUserApi.h b/samples/client/petstore/cpp-qt5/client/PFXUserApi.h index 4af297b9877..417c5a8d879 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXUserApi.h +++ b/samples/client/petstore/cpp-qt5/client/PFXUserApi.h @@ -3,7 +3,6 @@ * 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 @@ -23,30 +22,30 @@ namespace test_namespace { -class PFXUserApi: public QObject { +class PFXUserApi : public QObject { Q_OBJECT public: - PFXUserApi(const QString &scheme = "http", const QString &host = "petstore.swagger.io", int port = 0, const QString& basePath = "/v2", const int timeOut = 0); + PFXUserApi(const QString &scheme = "http", const QString &host = "petstore.swagger.io", int port = 0, const QString &basePath = "/v2", const int timeOut = 0); ~PFXUserApi(); void setScheme(const QString &scheme); void setHost(const QString &host); void setPort(int port); - void setBasePath(const QString& basePath); + void setBasePath(const QString &basePath); void setTimeOut(const int timeOut); - void setWorkingDirectory(const QString& path); - void addHeaders(const QString& key, const QString& value); + void setWorkingDirectory(const QString &path); + void addHeaders(const QString &key, const QString &value); - void createUser(const PFXUser& body); - void createUsersWithArrayInput(const QList& body); - void createUsersWithListInput(const QList& body); - void deleteUser(const QString& username); - void getUserByName(const QString& username); - void loginUser(const QString& username, const QString& password); + void createUser(const PFXUser &body); + void createUsersWithArrayInput(const QList &body); + void createUsersWithListInput(const QList &body); + void deleteUser(const QString &username); + void getUserByName(const QString &username); + void loginUser(const QString &username, const QString &password); void logoutUser(); - void updateUser(const QString& username, const PFXUser& body); - + void updateUser(const QString &username, const PFXUser &body); + private: QString _scheme, _host; int _port; @@ -54,16 +53,18 @@ private: int _timeOut; QString _workingDirectory; QMap defaultHeaders; - void createUserCallback (PFXHttpRequestWorker * worker); - void createUsersWithArrayInputCallback (PFXHttpRequestWorker * worker); - void createUsersWithListInputCallback (PFXHttpRequestWorker * worker); - void deleteUserCallback (PFXHttpRequestWorker * worker); - void getUserByNameCallback (PFXHttpRequestWorker * worker); - void loginUserCallback (PFXHttpRequestWorker * worker); - void logoutUserCallback (PFXHttpRequestWorker * worker); - void updateUserCallback (PFXHttpRequestWorker * worker); - + + void createUserCallback(PFXHttpRequestWorker *worker); + void createUsersWithArrayInputCallback(PFXHttpRequestWorker *worker); + void createUsersWithListInputCallback(PFXHttpRequestWorker *worker); + void deleteUserCallback(PFXHttpRequestWorker *worker); + void getUserByNameCallback(PFXHttpRequestWorker *worker); + void loginUserCallback(PFXHttpRequestWorker *worker); + void logoutUserCallback(PFXHttpRequestWorker *worker); + void updateUserCallback(PFXHttpRequestWorker *worker); + signals: + void createUserSignal(); void createUsersWithArrayInputSignal(); void createUsersWithListInputSignal(); @@ -72,16 +73,16 @@ signals: void loginUserSignal(QString summary); void logoutUserSignal(); void updateUserSignal(); - - void createUserSignalFull(PFXHttpRequestWorker* worker); - void createUsersWithArrayInputSignalFull(PFXHttpRequestWorker* worker); - void createUsersWithListInputSignalFull(PFXHttpRequestWorker* worker); - void deleteUserSignalFull(PFXHttpRequestWorker* worker); - void getUserByNameSignalFull(PFXHttpRequestWorker* worker, PFXUser summary); - void loginUserSignalFull(PFXHttpRequestWorker* worker, QString summary); - void logoutUserSignalFull(PFXHttpRequestWorker* worker); - void updateUserSignalFull(PFXHttpRequestWorker* worker); - + + void createUserSignalFull(PFXHttpRequestWorker *worker); + void createUsersWithArrayInputSignalFull(PFXHttpRequestWorker *worker); + void createUsersWithListInputSignalFull(PFXHttpRequestWorker *worker); + void deleteUserSignalFull(PFXHttpRequestWorker *worker); + void getUserByNameSignalFull(PFXHttpRequestWorker *worker, PFXUser summary); + void loginUserSignalFull(PFXHttpRequestWorker *worker, QString summary); + void logoutUserSignalFull(PFXHttpRequestWorker *worker); + void updateUserSignalFull(PFXHttpRequestWorker *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); @@ -90,17 +91,16 @@ signals: 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(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void createUsersWithArrayInputSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void createUsersWithListInputSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void deleteUserSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void getUserByNameSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void loginUserSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void logoutUserSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void updateUserSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - + + void createUserSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void createUsersWithArrayInputSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void createUsersWithListInputSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void deleteUserSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void getUserByNameSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loginUserSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void logoutUserSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void updateUserSignalEFull(PFXHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); }; -} +} // namespace test_namespace #endif diff --git a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go index 8128bba97c0..44a84210ab2 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go @@ -43,7 +43,6 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod // create path and map variables localVarPath := a.client.cfg.BasePath + "/another-fake/dummy" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_fake.go index db0a5d09f2e..8c0e6c80221 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake.go @@ -44,7 +44,6 @@ func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (* // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/create_xml_item" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -120,7 +119,6 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/boolean" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -217,7 +215,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/composite" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -318,7 +315,6 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/number" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -415,7 +411,6 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/string" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -504,7 +499,6 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileS // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/body-with-file-schema" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -572,7 +566,6 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/body-with-query-params" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -643,7 +636,6 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Cli // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -757,7 +749,6 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -901,7 +892,6 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1004,7 +994,6 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1081,7 +1070,6 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, pa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/inline-additionalProperties" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1149,7 +1137,6 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/jsonFormData" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1221,7 +1208,6 @@ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/test-query-paramters" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go index b729b05ba40..797ba66be5d 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go @@ -43,7 +43,6 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake_classname_test" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} diff --git a/samples/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/client/petstore/go-experimental/go-petstore/api_pet.go index ba752fcff27..97fcce49e6f 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_pet.go @@ -14,7 +14,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" "github.com/antihax/optional" "os" @@ -44,7 +43,6 @@ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Respon // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -118,7 +116,7 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -190,7 +188,6 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/findByStatus" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -279,7 +276,6 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/findByTags" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -368,7 +364,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -468,7 +464,6 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Res // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -544,7 +539,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -627,7 +622,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -739,7 +734,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/samples/client/petstore/go-experimental/go-petstore/api_store.go b/samples/client/petstore/go-experimental/go-petstore/api_store.go index af866af40c7..124da027994 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_store.go @@ -14,7 +14,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" ) @@ -43,7 +42,7 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -111,7 +110,6 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/inventory" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -211,7 +209,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -305,7 +303,6 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, * // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} diff --git a/samples/client/petstore/go-experimental/go-petstore/api_user.go b/samples/client/petstore/go-experimental/go-petstore/api_user.go index f4946e47528..a1cdb4586d3 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_user.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_user.go @@ -14,7 +14,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" ) @@ -43,7 +42,6 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp. // create path and map variables localVarPath := a.client.cfg.BasePath + "/user" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -110,7 +108,6 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body [] // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/createWithArray" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -177,7 +174,6 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/createWithList" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -245,7 +241,7 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -313,7 +309,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -402,7 +398,6 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/login" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -488,7 +483,6 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/logout" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -555,7 +549,7 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/samples/client/petstore/go-experimental/go-petstore/client.go b/samples/client/petstore/go-experimental/go-petstore/client.go index 343078e15cd..99adfbca747 100644 --- a/samples/client/petstore/go-experimental/go-petstore/client.go +++ b/samples/client/petstore/go-experimental/go-petstore/client.go @@ -17,8 +17,10 @@ import ( "errors" "fmt" "io" + "log" "mime/multipart" "net/http" + "net/http/httputil" "net/url" "os" "path/filepath" @@ -172,7 +174,27 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - return c.cfg.HTTPClient.Do(request) + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err } // ChangeBasePath changes base path to allow switching to mocks diff --git a/samples/client/petstore/go-experimental/go-petstore/configuration.go b/samples/client/petstore/go-experimental/go-petstore/configuration.go index 22f01da0a5c..5a4a915d1d3 100644 --- a/samples/client/petstore/go-experimental/go-petstore/configuration.go +++ b/samples/client/petstore/go-experimental/go-petstore/configuration.go @@ -10,7 +10,9 @@ package petstore import ( + "fmt" "net/http" + "strings" ) // contextKeys are used to identify the type of value in the context. @@ -49,6 +51,20 @@ type APIKey struct { Prefix string } +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + // Configuration stores the configuration of the API client type Configuration struct { BasePath string `json:"basePath,omitempty"` @@ -56,6 +72,8 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration HTTPClient *http.Client } @@ -65,6 +83,12 @@ func NewConfiguration() *Configuration { BasePath: "http://petstore.swagger.io:80/v2", DefaultHeader: make(map[string]string), UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: []ServerConfiguration{{ + Url: "http://petstore.swagger.io:80/v2", + Description: "No description provided", + }, + }, } return cfg } @@ -73,3 +97,31 @@ func NewConfiguration() *Configuration { func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} 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 a18998d7213..dbb36217de0 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 @@ -44,7 +44,6 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod // create path and map variables localVarPath := a.client.cfg.BasePath + "/another-fake/dummy" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 5a634ae8061..42920dcf040 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake.go @@ -45,7 +45,6 @@ func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (* // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/create_xml_item" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -121,7 +120,6 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/boolean" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -218,7 +216,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/composite" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -319,7 +316,6 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/number" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -416,7 +412,6 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/string" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -505,7 +500,6 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileS // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/body-with-file-schema" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -573,7 +567,6 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/body-with-query-params" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -644,7 +637,6 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Cli // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -758,7 +750,6 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -902,7 +893,6 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1005,7 +995,6 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1082,7 +1071,6 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, pa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/inline-additionalProperties" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1150,7 +1138,6 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/jsonFormData" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1222,7 +1209,6 @@ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/test-query-paramters" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 590326d2239..b02c47d4c9d 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 @@ -44,7 +44,6 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake_classname_test" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 07d9ab7765c..20a6c92965b 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_pet.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_pet.go @@ -15,7 +15,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" "github.com/antihax/optional" "os" @@ -45,7 +44,6 @@ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Respon // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -119,7 +117,7 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -191,7 +189,6 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/findByStatus" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -279,7 +276,6 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/findByTags" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -367,7 +363,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -464,7 +460,6 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Res // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -540,7 +535,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -623,7 +618,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -735,7 +730,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} 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 00ec8cb99c6..47faea8586b 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_store.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_store.go @@ -15,7 +15,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" ) @@ -44,7 +43,7 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -112,7 +111,6 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/inventory" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -210,7 +208,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -303,7 +301,6 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, * // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 f864cc33256..56bd4d3fc19 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_user.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_user.go @@ -15,7 +15,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" ) @@ -44,7 +43,6 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp. // create path and map variables localVarPath := a.client.cfg.BasePath + "/user" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -111,7 +109,6 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body [] // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/createWithArray" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -178,7 +175,6 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/createWithList" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -246,7 +242,7 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -314,7 +310,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -402,7 +398,6 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/login" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -487,7 +482,6 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/logout" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -554,7 +548,7 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/samples/client/petstore/go/go-petstore-withXml/client.go b/samples/client/petstore/go/go-petstore-withXml/client.go index 490d804736f..cc5ffa09cc6 100644 --- a/samples/client/petstore/go/go-petstore-withXml/client.go +++ b/samples/client/petstore/go/go-petstore-withXml/client.go @@ -18,8 +18,10 @@ import ( "errors" "fmt" "io" + "log" "mime/multipart" "net/http" + "net/http/httputil" "net/url" "os" "path/filepath" @@ -173,7 +175,28 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - return c.cfg.HTTPClient.Do(request) + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + + return resp, err } // ChangeBasePath changes base path to allow switching to mocks diff --git a/samples/client/petstore/go/go-petstore-withXml/configuration.go b/samples/client/petstore/go/go-petstore-withXml/configuration.go index d471b566189..59728f054c7 100644 --- a/samples/client/petstore/go/go-petstore-withXml/configuration.go +++ b/samples/client/petstore/go/go-petstore-withXml/configuration.go @@ -11,7 +11,9 @@ package petstore import ( + "fmt" "net/http" + "strings" ) // contextKeys are used to identify the type of value in the context. @@ -50,6 +52,20 @@ type APIKey struct { Prefix string } +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + // Configuration stores the configuration of the API client type Configuration struct { BasePath string `json:"basePath,omitempty"` @@ -57,6 +73,8 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration HTTPClient *http.Client } @@ -66,6 +84,12 @@ func NewConfiguration() *Configuration { BasePath: "http://petstore.swagger.io:80/v2", DefaultHeader: make(map[string]string), UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: []ServerConfiguration{{ + Url: "http://petstore.swagger.io:80/v2", + Description: "No description provided", + }, + }, } return cfg } @@ -74,3 +98,31 @@ func NewConfiguration() *Configuration { func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} 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 8128bba97c0..44a84210ab2 100644 --- a/samples/client/petstore/go/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go/go-petstore/api_another_fake.go @@ -43,7 +43,6 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod // create path and map variables localVarPath := a.client.cfg.BasePath + "/another-fake/dummy" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} diff --git a/samples/client/petstore/go/go-petstore/api_fake.go b/samples/client/petstore/go/go-petstore/api_fake.go index db0a5d09f2e..8c0e6c80221 100644 --- a/samples/client/petstore/go/go-petstore/api_fake.go +++ b/samples/client/petstore/go/go-petstore/api_fake.go @@ -44,7 +44,6 @@ func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (* // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/create_xml_item" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -120,7 +119,6 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/boolean" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -217,7 +215,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/composite" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -318,7 +315,6 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/number" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -415,7 +411,6 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/string" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -504,7 +499,6 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileS // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/body-with-file-schema" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -572,7 +566,6 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/body-with-query-params" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -643,7 +636,6 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Cli // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -757,7 +749,6 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -901,7 +892,6 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1004,7 +994,6 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1081,7 +1070,6 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, pa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/inline-additionalProperties" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1149,7 +1137,6 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/jsonFormData" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1221,7 +1208,6 @@ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/test-query-paramters" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 1ff9eccc0fb..7bd5e4b54e3 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 @@ -43,7 +43,6 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake_classname_test" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} diff --git a/samples/client/petstore/go/go-petstore/api_pet.go b/samples/client/petstore/go/go-petstore/api_pet.go index 2eac738d41a..6aea8875210 100644 --- a/samples/client/petstore/go/go-petstore/api_pet.go +++ b/samples/client/petstore/go/go-petstore/api_pet.go @@ -14,7 +14,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" "github.com/antihax/optional" "os" @@ -44,7 +43,6 @@ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Respon // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -118,7 +116,7 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -190,7 +188,6 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/findByStatus" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -278,7 +275,6 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/findByTags" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -366,7 +362,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -463,7 +459,6 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Res // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -539,7 +534,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -622,7 +617,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -734,7 +729,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/samples/client/petstore/go/go-petstore/api_store.go b/samples/client/petstore/go/go-petstore/api_store.go index 50486285664..a480157234a 100644 --- a/samples/client/petstore/go/go-petstore/api_store.go +++ b/samples/client/petstore/go/go-petstore/api_store.go @@ -14,7 +14,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" ) @@ -43,7 +42,7 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -111,7 +110,6 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/inventory" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -209,7 +207,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -302,7 +300,6 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, * // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} diff --git a/samples/client/petstore/go/go-petstore/api_user.go b/samples/client/petstore/go/go-petstore/api_user.go index 5eb1a3ced9a..154fc0962da 100644 --- a/samples/client/petstore/go/go-petstore/api_user.go +++ b/samples/client/petstore/go/go-petstore/api_user.go @@ -14,7 +14,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" ) @@ -43,7 +42,6 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp. // create path and map variables localVarPath := a.client.cfg.BasePath + "/user" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -110,7 +108,6 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body [] // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/createWithArray" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -177,7 +174,6 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/createWithList" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -245,7 +241,7 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -313,7 +309,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -401,7 +397,6 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/login" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -486,7 +481,6 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/logout" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -553,7 +547,7 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index 343078e15cd..0c97916457d 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -17,8 +17,10 @@ import ( "errors" "fmt" "io" + "log" "mime/multipart" "net/http" + "net/http/httputil" "net/url" "os" "path/filepath" @@ -172,7 +174,28 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - return c.cfg.HTTPClient.Do(request) + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + + return resp, err } // ChangeBasePath changes base path to allow switching to mocks diff --git a/samples/client/petstore/go/go-petstore/configuration.go b/samples/client/petstore/go/go-petstore/configuration.go index b3b81ad0824..34f8f242922 100644 --- a/samples/client/petstore/go/go-petstore/configuration.go +++ b/samples/client/petstore/go/go-petstore/configuration.go @@ -10,7 +10,9 @@ package petstore import ( + "fmt" "net/http" + "strings" ) // contextKeys are used to identify the type of value in the context. @@ -49,6 +51,20 @@ type APIKey struct { Prefix string } +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + // Configuration stores the configuration of the API client type Configuration struct { BasePath string `json:"basePath,omitempty"` @@ -56,6 +72,8 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration HTTPClient *http.Client } @@ -65,6 +83,12 @@ func NewConfiguration() *Configuration { BasePath: "http://petstore.swagger.io:80/v2", DefaultHeader: make(map[string]string), UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: []ServerConfiguration{{ + Url: "http://petstore.swagger.io:80/v2", + Description: "No description provided", + }, + }, } return cfg } @@ -73,3 +97,31 @@ func NewConfiguration() *Configuration { func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} diff --git a/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/feign/gradlew b/samples/client/petstore/java/feign/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/feign/gradlew +++ b/samples/client/petstore/java/feign/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/feign/gradlew.bat b/samples/client/petstore/java/feign/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/feign/gradlew.bat +++ b/samples/client/petstore/java/feign/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 0f1223c2bc6..b3b18538873 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ AdditionalPropertiesAnyType.JSON_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class AdditionalPropertiesAnyType extends HashMap { public static final String JSON_PROPERTY_NAME = "name"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index c03535ab947..b096a099e9d 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ AdditionalPropertiesArray.JSON_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class AdditionalPropertiesArray extends HashMap { public static final String JSON_PROPERTY_NAME = "name"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 4356a4f8c1e..cb08b798a87 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ AdditionalPropertiesBoolean.JSON_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class AdditionalPropertiesBoolean extends HashMap { public static final String JSON_PROPERTY_NAME = "name"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 781d4686e98..e35f2cca9ab 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -43,6 +43,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE2, AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE3 }) +@javax.annotation.concurrent.Immutable public class AdditionalPropertiesClass { public static final String JSON_PROPERTY_MAP_STRING = "map_string"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index 2426e7c974c..c3241fbab3d 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ AdditionalPropertiesInteger.JSON_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class AdditionalPropertiesInteger extends HashMap { public static final String JSON_PROPERTY_NAME = "name"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index da407ccdc47..2e4c40ce549 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ AdditionalPropertiesNumber.JSON_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class AdditionalPropertiesNumber extends HashMap { public static final String JSON_PROPERTY_NAME = "name"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 5e468870311..ac8cd6cf152 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ AdditionalPropertiesObject.JSON_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class AdditionalPropertiesObject extends HashMap { public static final String JSON_PROPERTY_NAME = "name"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index ed080254966..94b3707ee95 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ AdditionalPropertiesString.JSON_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class AdditionalPropertiesString extends HashMap { public static final String JSON_PROPERTY_NAME = "name"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..845a10ecb10 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; Animal.JSON_PROPERTY_CLASS_NAME, Animal.JSON_PROPERTY_COLOR }) +@javax.annotation.concurrent.Immutable @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) @JsonSubTypes({ diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 96f829bc648..d2b96d3910a 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER }) +@javax.annotation.concurrent.Immutable public class ArrayOfArrayOfNumberOnly { public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 37e40dbd3ec..c4ad3fd608d 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER }) +@javax.annotation.concurrent.Immutable public class ArrayOfNumberOnly { public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java index de7c895ac93..c650f156e57 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -34,6 +34,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL }) +@javax.annotation.concurrent.Immutable public class ArrayTest { public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Capitalization.java index 033e9788110..20050a23c00 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Capitalization.java @@ -34,6 +34,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E }) +@javax.annotation.concurrent.Immutable public class Capitalization { public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java index 569d7d08d59..80b4560effc 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ Cat.JSON_PROPERTY_DECLAWED }) +@javax.annotation.concurrent.Immutable public class Cat extends Animal { public static final String JSON_PROPERTY_DECLAWED = "declawed"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/CatAllOf.java index cc04e0e022d..a1c88ddb120 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ CatAllOf.JSON_PROPERTY_DECLAWED }) +@javax.annotation.concurrent.Immutable public class CatAllOf { public static final String JSON_PROPERTY_DECLAWED = "declawed"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java index 868ba875074..e351a7841bb 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java @@ -30,6 +30,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; Category.JSON_PROPERTY_ID, Category.JSON_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class Category { public static final String JSON_PROPERTY_ID = "id"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ClassModel.java index 4de7664b26a..01403deddd8 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ClassModel.java @@ -30,6 +30,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ ClassModel.JSON_PROPERTY_PROPERTY_CLASS }) +@javax.annotation.concurrent.Immutable public class ClassModel { public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Client.java index 02b0aac2247..6cd245b2f72 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Client.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ Client.JSON_PROPERTY_CLIENT }) +@javax.annotation.concurrent.Immutable public class Client { public static final String JSON_PROPERTY_CLIENT = "client"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java index 78044654d50..fd9ac0975c6 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ Dog.JSON_PROPERTY_BREED }) +@javax.annotation.concurrent.Immutable public class Dog extends Animal { public static final String JSON_PROPERTY_BREED = "breed"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/DogAllOf.java index dd42595cf20..57942316357 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ DogAllOf.JSON_PROPERTY_BREED }) +@javax.annotation.concurrent.Immutable public class DogAllOf { public static final String JSON_PROPERTY_BREED = "breed"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java index aff182cd498..5585af2f9c2 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; EnumArrays.JSON_PROPERTY_JUST_SYMBOL, EnumArrays.JSON_PROPERTY_ARRAY_ENUM }) +@javax.annotation.concurrent.Immutable public class EnumArrays { /** diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumTest.java index 51a1a645a10..ca72f8b9012 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumTest.java @@ -34,6 +34,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; EnumTest.JSON_PROPERTY_ENUM_NUMBER, EnumTest.JSON_PROPERTY_OUTER_ENUM }) +@javax.annotation.concurrent.Immutable public class EnumTest { /** diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 8166597792d..d1793a655e0 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; FileSchemaTestClass.JSON_PROPERTY_FILE, FileSchemaTestClass.JSON_PROPERTY_FILES }) +@javax.annotation.concurrent.Immutable public class FileSchemaTestClass { public static final String JSON_PROPERTY_FILE = "file"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FormatTest.java index 4dee7f6c9dc..20939e85f8b 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FormatTest.java @@ -47,6 +47,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; FormatTest.JSON_PROPERTY_PASSWORD, FormatTest.JSON_PROPERTY_BIG_DECIMAL }) +@javax.annotation.concurrent.Immutable public class FormatTest { public static final String JSON_PROPERTY_INTEGER = "integer"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 0a3f0d46436..43e9ddd65f6 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -30,6 +30,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; HasOnlyReadOnly.JSON_PROPERTY_BAR, HasOnlyReadOnly.JSON_PROPERTY_FOO }) +@javax.annotation.concurrent.Immutable public class HasOnlyReadOnly { public static final String JSON_PROPERTY_BAR = "bar"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java index 113f92dd9cb..62492374cca 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java @@ -35,6 +35,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; MapTest.JSON_PROPERTY_DIRECT_MAP, MapTest.JSON_PROPERTY_INDIRECT_MAP }) +@javax.annotation.concurrent.Immutable public class MapTest { public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index d483d69700f..205ba6040a9 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP }) +@javax.annotation.concurrent.Immutable public class MixedPropertiesAndAdditionalPropertiesClass { public static final String JSON_PROPERTY_UUID = "uuid"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Model200Response.java index dd99468a005..5d4a6f98461 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Model200Response.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; Model200Response.JSON_PROPERTY_NAME, Model200Response.JSON_PROPERTY_PROPERTY_CLASS }) +@javax.annotation.concurrent.Immutable public class Model200Response { public static final String JSON_PROPERTY_NAME = "name"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 383cafdd3a5..d6acae129e4 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; ModelApiResponse.JSON_PROPERTY_TYPE, ModelApiResponse.JSON_PROPERTY_MESSAGE }) +@javax.annotation.concurrent.Immutable public class ModelApiResponse { public static final String JSON_PROPERTY_CODE = "code"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelReturn.java index b62e13a90a0..9b51c8944a4 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -30,6 +30,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ ModelReturn.JSON_PROPERTY_RETURN }) +@javax.annotation.concurrent.Immutable public class ModelReturn { public static final String JSON_PROPERTY_RETURN = "return"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Name.java index bd625c5f66f..811858d4a84 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Name.java @@ -33,6 +33,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; Name.JSON_PROPERTY_PROPERTY, Name.JSON_PROPERTY_123NUMBER }) +@javax.annotation.concurrent.Immutable public class Name { public static final String JSON_PROPERTY_NAME = "name"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NumberOnly.java index 5ca72a169fe..7e27fe83b1c 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -30,6 +30,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ NumberOnly.JSON_PROPERTY_JUST_NUMBER }) +@javax.annotation.concurrent.Immutable public class NumberOnly { public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Order.java index d4f5f1c55bd..aa3d4a98d0c 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Order.java @@ -35,6 +35,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; Order.JSON_PROPERTY_STATUS, Order.JSON_PROPERTY_COMPLETE }) +@javax.annotation.concurrent.Immutable public class Order { public static final String JSON_PROPERTY_ID = "id"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/OuterComposite.java index 4d73ff2bbd6..89b5ed48f3b 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; OuterComposite.JSON_PROPERTY_MY_STRING, OuterComposite.JSON_PROPERTY_MY_BOOLEAN }) +@javax.annotation.concurrent.Immutable public class OuterComposite { public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java index be74dd5ca08..874476d41a3 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java @@ -38,6 +38,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; Pet.JSON_PROPERTY_TAGS, Pet.JSON_PROPERTY_STATUS }) +@javax.annotation.concurrent.Immutable public class Pet { public static final String JSON_PROPERTY_ID = "id"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index b3e58ef3d2c..1cee03d06c3 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -30,6 +30,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; ReadOnlyFirst.JSON_PROPERTY_BAR, ReadOnlyFirst.JSON_PROPERTY_BAZ }) +@javax.annotation.concurrent.Immutable public class ReadOnlyFirst { public static final String JSON_PROPERTY_BAR = "bar"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/SpecialModelName.java index 35ad3bf4699..453c8ad9b99 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class SpecialModelName { public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Tag.java index a3ecb398faa..a7c2f4cafe2 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Tag.java @@ -30,6 +30,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; Tag.JSON_PROPERTY_ID, Tag.JSON_PROPERTY_NAME }) +@javax.annotation.concurrent.Immutable public class Tag { public static final String JSON_PROPERTY_ID = "id"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index e5996f69468..f5a3d19c0a9 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -36,6 +36,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; TypeHolderDefault.JSON_PROPERTY_BOOL_ITEM, TypeHolderDefault.JSON_PROPERTY_ARRAY_ITEM }) +@javax.annotation.concurrent.Immutable public class TypeHolderDefault { public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java index b7f141913e7..d00f5441862 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; TypeHolderExample.JSON_PROPERTY_BOOL_ITEM, TypeHolderExample.JSON_PROPERTY_ARRAY_ITEM }) +@javax.annotation.concurrent.Immutable public class TypeHolderExample { public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/User.java index b7e74643dab..f83fb1e6718 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/User.java @@ -36,6 +36,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; User.JSON_PROPERTY_PHONE, User.JSON_PROPERTY_USER_STATUS }) +@javax.annotation.concurrent.Immutable public class User { public static final String JSON_PROPERTY_ID = "id"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java index 65e7c295192..22d7ad37054 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java @@ -60,6 +60,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; XmlItem.JSON_PROPERTY_PREFIX_NS_ARRAY, XmlItem.JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY }) +@javax.annotation.concurrent.Immutable public class XmlItem { public static final String JSON_PROPERTY_ATTRIBUTE_STRING = "attribute_string"; diff --git a/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/feign10x/gradlew b/samples/client/petstore/java/feign10x/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/feign10x/gradlew +++ b/samples/client/petstore/java/feign10x/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/feign10x/gradlew.bat b/samples/client/petstore/java/feign10x/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/feign10x/gradlew.bat +++ b/samples/client/petstore/java/feign10x/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/google-api-client/gradlew b/samples/client/petstore/java/google-api-client/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/google-api-client/gradlew +++ b/samples/client/petstore/java/google-api-client/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/google-api-client/gradlew.bat b/samples/client/petstore/java/google-api-client/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/google-api-client/gradlew.bat +++ b/samples/client/petstore/java/google-api-client/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/jersey1/gradlew b/samples/client/petstore/java/jersey1/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/jersey1/gradlew +++ b/samples/client/petstore/java/jersey1/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/jersey1/gradlew.bat b/samples/client/petstore/java/jersey1/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/jersey1/gradlew.bat +++ b/samples/client/petstore/java/jersey1/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/jersey2-java6/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey2-java6/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/jersey2-java6/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/jersey2-java6/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/jersey2-java6/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey2-java6/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/jersey2-java6/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/jersey2-java6/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/jersey2-java6/gradlew b/samples/client/petstore/java/jersey2-java6/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/jersey2-java6/gradlew +++ b/samples/client/petstore/java/jersey2-java6/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/jersey2-java6/gradlew.bat b/samples/client/petstore/java/jersey2-java6/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/jersey2-java6/gradlew.bat +++ b/samples/client/petstore/java/jersey2-java6/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/jersey2-java8/gradlew b/samples/client/petstore/java/jersey2-java8/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/jersey2-java8/gradlew +++ b/samples/client/petstore/java/jersey2-java8/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/jersey2-java8/gradlew.bat b/samples/client/petstore/java/jersey2-java8/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/jersey2-java8/gradlew.bat +++ b/samples/client/petstore/java/jersey2-java8/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/jersey2/gradlew b/samples/client/petstore/java/jersey2/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/jersey2/gradlew +++ b/samples/client/petstore/java/jersey2/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/jersey2/gradlew.bat b/samples/client/petstore/java/jersey2/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/jersey2/gradlew.bat +++ b/samples/client/petstore/java/jersey2/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/microprofile-rest-client/.openapi-generator-ignore b/samples/client/petstore/java/microprofile-rest-client/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/.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/client/petstore/java/microprofile-rest-client/.openapi-generator/VERSION b/samples/client/petstore/java/microprofile-rest-client/.openapi-generator/VERSION new file mode 100644 index 00000000000..bfbf77eb7fa --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/java/microprofile-rest-client/README.md b/samples/client/petstore/java/microprofile-rest-client/README.md new file mode 100644 index 00000000000..e95301f74cd --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/README.md @@ -0,0 +1,8 @@ +# OpenAPI Petstore - MicroProfile Rest Client + +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. +[MicroProfile Rest Client](https://github.com/eclipse/microprofile-rest-client) is a type-safe way of calling +REST services. The generated client contains an interface which acts as the client, you can inject it into dependent classes. diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/Category.md b/samples/client/petstore/java/microprofile-rest-client/docs/Category.md new file mode 100644 index 00000000000..eac8fab40f3 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/docs/Category.md @@ -0,0 +1,14 @@ + + +# Category + +A category for a pet +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/ModelApiResponse.md b/samples/client/petstore/java/microprofile-rest-client/docs/ModelApiResponse.md new file mode 100644 index 00000000000..aaf138e7ff7 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/docs/ModelApiResponse.md @@ -0,0 +1,15 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/Order.md b/samples/client/petstore/java/microprofile-rest-client/docs/Order.md new file mode 100644 index 00000000000..cfb4ab3d4dd --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/docs/Order.md @@ -0,0 +1,28 @@ + + +# Order + +An order for a pets from the pet store +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**Date**](Date.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +PLACED | "placed" +APPROVED | "approved" +DELIVERED | "delivered" + + + diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/Pet.md b/samples/client/petstore/java/microprofile-rest-client/docs/Pet.md new file mode 100644 index 00000000000..a2664e601e8 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/docs/Pet.md @@ -0,0 +1,28 @@ + + +# Pet + +A pet for sale in the pet store +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +AVAILABLE | "available" +PENDING | "pending" +SOLD | "sold" + + + diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md b/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md new file mode 100644 index 00000000000..3e784666f13 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md @@ -0,0 +1,584 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +## addPet + +> void addPet(body) + +Add a new pet to the store + +### Example + +```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.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // 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(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + void result = apiInstance.addPet(body); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +[**void**](Void.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +## deletePet + +> void deletePet(petId, apiKey) + +Deletes a pet + +### Example + +```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.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // 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(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + void result = apiInstance.deletePet(petId, apiKey); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +[**void**](Void.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +## findPetsByStatus + +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```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.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // 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(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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **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 + +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```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.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // 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(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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **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 + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```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.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/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"); + + 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **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 + +> void updatePet(body) + +Update an existing pet + +### Example + +```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.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // 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(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + void result = apiInstance.updatePet(body); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +[**void**](Void.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> void updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example + +```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.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // 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(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 { + void result = apiInstance.updatePetWithForm(petId, name, status); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] + +### Return type + +[**void**](Void.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +## uploadFile + +> ModelApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example + +```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.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // 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(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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **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/microprofile-rest-client/docs/StoreApi.md b/samples/client/petstore/java/microprofile-rest-client/docs/StoreApi.md new file mode 100644 index 00000000000..f43fc7d76fe --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/docs/StoreApi.md @@ -0,0 +1,277 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + + +## deleteOrder + +> void deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import 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/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + void result = apiInstance.deleteOrder(orderId); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +[**void**](Void.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## getInventory + +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```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.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/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"); + + 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(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## getOrderById + +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example + +```java +// Import classes: +import 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/v2"); + + 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Long**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **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 + +> Order placeOrder(body) + +Place an order for a pet + +### Example + +```java +// Import classes: +import 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/v2"); + + 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **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/microprofile-rest-client/docs/Tag.md b/samples/client/petstore/java/microprofile-rest-client/docs/Tag.md new file mode 100644 index 00000000000..58beb5e14ec --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + +A tag for a pet +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/User.md b/samples/client/petstore/java/microprofile-rest-client/docs/User.md new file mode 100644 index 00000000000..d34ff1a4d89 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/docs/User.md @@ -0,0 +1,20 @@ + + +# User + +A User who is purchasing from the pet store +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **Integer** | User Status | [optional] + + + diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/UserApi.md b/samples/client/petstore/java/microprofile-rest-client/docs/UserApi.md new file mode 100644 index 00000000000..891af257889 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/docs/UserApi.md @@ -0,0 +1,531 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + + +## createUser + +> void createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import 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/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + void result = apiInstance.createUser(body); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +[**void**](Void.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## createUsersWithArrayInput + +> void createUsersWithArrayInput(body) + +Creates list of users with given input array + +### Example + +```java +// Import classes: +import 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/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(); // List | List of user object + try { + void result = apiInstance.createUsersWithArrayInput(body); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +[**void**](Void.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## createUsersWithListInput + +> void createUsersWithListInput(body) + +Creates list of users with given input array + +### Example + +```java +// Import classes: +import 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/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(); // List | List of user object + try { + void result = apiInstance.createUsersWithListInput(body); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +[**void**](Void.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## deleteUser + +> void deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import 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/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + void result = apiInstance.deleteUser(username); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +[**void**](Void.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## getUserByName + +> User getUserByName(username) + +Get user by user name + +### Example + +```java +// Import classes: +import 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/v2"); + + 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **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 + +> String loginUser(username, password) + +Logs user into the system + +### Example + +```java +// Import classes: +import 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/v2"); + + 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **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 toekn expires
| +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> void logoutUser() + +Logs out current logged in user session + +### Example + +```java +// Import classes: +import 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/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + void result = apiInstance.logoutUser(); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**void**](Void.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## updateUser + +> void updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import 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/v2"); + + 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 { + void result = apiInstance.updateUser(username, body); + System.out.println(result); + } 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(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +[**void**](Void.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **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/microprofile-rest-client/pom.xml b/samples/client/petstore/java/microprofile-rest-client/pom.xml new file mode 100644 index 00000000000..f8c57252b94 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/pom.xml @@ -0,0 +1,141 @@ + + 4.0.0 + org.openapitools + microprofile-rest-client + jar + microprofile-rest-client + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + 1.0.0 + + src/main/java + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + junit + junit + ${junit-version} + test + + + + org.eclipse.microprofile.rest.client + microprofile-rest-client-api + 1.2.1 + + + + + javax.ws.rs + javax.ws.rs-api + 2.1.1 + provided + + + + io.smallrye + smallrye-rest-client + 1.2.1 + test + + + + io.smallrye + smallrye-config + 1.3.5 + test + + + + org.apache.cxf + cxf-rt-rs-extension-providers + 3.2.6 + + + + javax.json.bind + javax.json.bind-api + 1.0 + + + javax.xml.bind + jaxb-api + 2.2.11 + + + com.sun.xml.bind + jaxb-core + 2.2.11 + + + com.sun.xml.bind + jaxb-impl + 2.2.11 + + + javax.activation + activation + 1.1.1 + + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-jaxrs-version} + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 1.8 + ${java.version} + ${java.version} + 1.5.18 + 9.2.9.v20150224 + 4.12 + 1.1.7 + 2.5 + 3.2.7 + 2.9.7 + UTF-8 + + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/ApiException.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/ApiException.java new file mode 100644 index 00000000000..500854ee230 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/ApiException.java @@ -0,0 +1,46 @@ +/** + * 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. + * + * 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.client.api; + +import javax.ws.rs.core.Response; + +public class ApiException extends Exception { + + private static final long serialVersionUID = 1L; + private Response response; + + public ApiException() { + super(); + } + + public ApiException(Response response) { + super("Api response has status code " + response.getStatus()); + this.response = response; + } + + public Response getResponse() { + return this.response; + } +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/ApiExceptionMapper.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/ApiExceptionMapper.java new file mode 100644 index 00000000000..ea43b858bd8 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/ApiExceptionMapper.java @@ -0,0 +1,45 @@ +/** + * 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. + * + * 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.client.api; + +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; + +@Provider +public class ApiExceptionMapper + implements ResponseExceptionMapper { + + @Override + public boolean handles(int status, MultivaluedMap headers) { + return status >= 400; + } + + @Override + public ApiException toThrowable(Response response) { + return new ApiException(response); + } +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 00000000000..5bd3c51c8c4 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,133 @@ +/** + * 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. + * + * 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.client.api; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +/** + * 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. + * + */ + +@RegisterRestClient +@RegisterProvider(ApiExceptionMapper.class) +@Path("/") +public interface PetApi { + + /** + * Add a new pet to the store + * + */ + @POST + @Path("/pet") + @Consumes({ "application/json", "application/xml" }) + public void addPet(Pet body) throws ApiException, ProcessingException; + + /** + * Deletes a pet + * + */ + @DELETE + @Path("/pet/{petId}") + public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + */ + @GET + @Path("/pet/findByStatus") + @Produces({ "application/xml", "application/json" }) + public List findPetsByStatus(@QueryParam("status") List status) throws ApiException, ProcessingException; + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + */ + @GET + @Path("/pet/findByTags") + @Produces({ "application/xml", "application/json" }) + public List findPetsByTags(@QueryParam("tags") List tags) throws ApiException, ProcessingException; + + /** + * Find pet by ID + * + * Returns a single pet + * + */ + @GET + @Path("/pet/{petId}") + @Produces({ "application/xml", "application/json" }) + public Pet getPetById(@PathParam("petId") Long petId) throws ApiException, ProcessingException; + + /** + * Update an existing pet + * + */ + @PUT + @Path("/pet") + @Consumes({ "application/json", "application/xml" }) + public void updatePet(Pet body) throws ApiException, ProcessingException; + + /** + * Updates a pet in the store with form data + * + */ + @POST + @Path("/pet/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status) throws ApiException, ProcessingException; + + /** + * uploads an image + * + */ + @POST + @Path("/pet/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail) throws ApiException, ProcessingException; +} + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 00000000000..e017375ba14 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,94 @@ +/** + * 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. + * + * 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.client.api; + +import org.openapitools.client.model.Order; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +/** + * 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. + * + */ + +@RegisterRestClient +@RegisterProvider(ApiExceptionMapper.class) +@Path("/") +public interface StoreApi { + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + */ + @DELETE + @Path("/store/order/{orderId}") + public void deleteOrder(@PathParam("orderId") String orderId) throws ApiException, ProcessingException; + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + */ + @GET + @Path("/store/inventory") + @Produces({ "application/json" }) + public Map getInventory() throws ApiException, ProcessingException; + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + */ + @GET + @Path("/store/order/{orderId}") + @Produces({ "application/xml", "application/json" }) + public Order getOrderById(@PathParam("orderId") Long orderId) throws ApiException, ProcessingException; + + /** + * Place an order for a pet + * + */ + @POST + @Path("/store/order") + @Produces({ "application/xml", "application/json" }) + public Order placeOrder(Order body) throws ApiException, ProcessingException; +} + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 00000000000..c40f105e971 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,125 @@ +/** + * 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. + * + * 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.client.api; + +import org.openapitools.client.model.User; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +/** + * 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. + * + */ + +@RegisterRestClient +@RegisterProvider(ApiExceptionMapper.class) +@Path("/") +public interface UserApi { + + /** + * Create user + * + * This can only be done by the logged in user. + * + */ + @POST + @Path("/user") + public void createUser(User body) throws ApiException, ProcessingException; + + /** + * Creates list of users with given input array + * + */ + @POST + @Path("/user/createWithArray") + public void createUsersWithArrayInput(List body) throws ApiException, ProcessingException; + + /** + * Creates list of users with given input array + * + */ + @POST + @Path("/user/createWithList") + public void createUsersWithListInput(List body) throws ApiException, ProcessingException; + + /** + * Delete user + * + * This can only be done by the logged in user. + * + */ + @DELETE + @Path("/user/{username}") + public void deleteUser(@PathParam("username") String username) throws ApiException, ProcessingException; + + /** + * Get user by user name + * + */ + @GET + @Path("/user/{username}") + @Produces({ "application/xml", "application/json" }) + public User getUserByName(@PathParam("username") String username) throws ApiException, ProcessingException; + + /** + * Logs user into the system + * + */ + @GET + @Path("/user/login") + @Produces({ "application/xml", "application/json" }) + public String loginUser(@QueryParam("username") String username, @QueryParam("password") String password) throws ApiException, ProcessingException; + + /** + * Logs out current logged in user session + * + */ + @GET + @Path("/user/logout") + public void logoutUser() throws ApiException, ProcessingException; + + /** + * Updated user + * + * This can only be done by the logged in user. + * + */ + @PUT + @Path("/user/{username}") + public void updateUser(@PathParam("username") String username, User body) throws ApiException, ProcessingException; +} + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 00000000000..78b8362f881 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,114 @@ +/** + * 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. + * + * 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.client.model; + + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.json.bind.annotation.JsonbProperty; + +/** + * A category for a pet + **/ +public class Category { + + private Long id; + + private String name; + + /** + * Get id + * @return id + **/ + @JsonbProperty("id") + public Long getId() { + return id; + } + + /** + * Set id + **/ + public void setId(Long id) { + this.id = id; + } + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonbProperty("name") + public String getName() { + return name; + } + + /** + * Set name + **/ + public void setName(String name) { + this.name = name; + } + + public Category name(String name) { + this.name = name; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 00000000000..64fbd3a80f0 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,138 @@ +/** + * 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. + * + * 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.client.model; + + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.json.bind.annotation.JsonbProperty; + +/** + * Describes the result of uploading an image resource + **/ +public class ModelApiResponse { + + private Integer code; + + private String type; + + private String message; + + /** + * Get code + * @return code + **/ + @JsonbProperty("code") + public Integer getCode() { + return code; + } + + /** + * Set code + **/ + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get type + * @return type + **/ + @JsonbProperty("type") + public String getType() { + return type; + } + + /** + * Set type + **/ + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get message + * @return message + **/ + @JsonbProperty("message") + public String getMessage() { + return message; + } + + /** + * Set message + **/ + public void setMessage(String message) { + this.message = message; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 00000000000..4a91c65d22d --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,249 @@ +/** + * 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. + * + * 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.client.model; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.json.bind.annotation.JsonbProperty; + +/** + * An order for a pets from the pet store + **/ +public class Order { + + private Long id; + + private Long petId; + + private Integer quantity; + + private Date shipDate; + +@XmlType(name="StatusEnum") +@XmlEnum(String.class) +public enum StatusEnum { + +@XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String v) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + v + "'"); + } +} + + /** + * Order Status + **/ + private StatusEnum status; + + private Boolean complete = false; + + /** + * Get id + * @return id + **/ + @JsonbProperty("id") + public Long getId() { + return id; + } + + /** + * Set id + **/ + public void setId(Long id) { + this.id = id; + } + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get petId + * @return petId + **/ + @JsonbProperty("petId") + public Long getPetId() { + return petId; + } + + /** + * Set petId + **/ + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @JsonbProperty("quantity") + public Integer getQuantity() { + return quantity; + } + + /** + * Set quantity + **/ + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @JsonbProperty("shipDate") + public Date getShipDate() { + return shipDate; + } + + /** + * Set shipDate + **/ + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Order Status + * @return status + **/ + @JsonbProperty("status") + public String getStatus() { + if (status == null) { + return null; + } + return status.value(); + } + + /** + * Set status + **/ + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get complete + * @return complete + **/ + @JsonbProperty("complete") + public Boolean getComplete() { + return complete; + } + + /** + * Set complete + **/ + public void setComplete(Boolean complete) { + this.complete = complete; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 00000000000..1cdddd7789d --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,262 @@ +/** + * 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. + * + * 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.client.model; + +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.json.bind.annotation.JsonbProperty; + +/** + * A pet for sale in the pet store + **/ +public class Pet { + + private Long id; + + private Category category; + + private String name; + + private List photoUrls = new ArrayList(); + + private List tags = null; + +@XmlType(name="StatusEnum") +@XmlEnum(String.class) +public enum StatusEnum { + +@XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String v) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + v + "'"); + } +} + + /** + * pet status in the store + **/ + private StatusEnum status; + + /** + * Get id + * @return id + **/ + @JsonbProperty("id") + public Long getId() { + return id; + } + + /** + * Set id + **/ + public void setId(Long id) { + this.id = id; + } + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get category + * @return category + **/ + @JsonbProperty("category") + public Category getCategory() { + return category; + } + + /** + * Set category + **/ + public void setCategory(Category category) { + this.category = category; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonbProperty("name") + public String getName() { + return name; + } + + /** + * Set name + **/ + public void setName(String name) { + this.name = name; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @JsonbProperty("photoUrls") + public List getPhotoUrls() { + return photoUrls; + } + + /** + * Set photoUrls + **/ + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @JsonbProperty("tags") + public List getTags() { + return tags; + } + + /** + * Set tags + **/ + public void setTags(List tags) { + this.tags = tags; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * pet status in the store + * @return status + **/ + @JsonbProperty("status") + public String getStatus() { + if (status == null) { + return null; + } + return status.value(); + } + + /** + * Set status + **/ + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 00000000000..5915eb2f4d4 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,114 @@ +/** + * 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. + * + * 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.client.model; + + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.json.bind.annotation.JsonbProperty; + +/** + * A tag for a pet + **/ +public class Tag { + + private Long id; + + private String name; + + /** + * Get id + * @return id + **/ + @JsonbProperty("id") + public Long getId() { + return id; + } + + /** + * Set id + **/ + public void setId(Long id) { + this.id = id; + } + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonbProperty("name") + public String getName() { + return name; + } + + /** + * Set name + **/ + public void setName(String name) { + this.name = name; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 00000000000..49cfbedb33f --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,261 @@ +/** + * 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. + * + * 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.client.model; + + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.json.bind.annotation.JsonbProperty; + +/** + * A User who is purchasing from the pet store + **/ +public class User { + + private Long id; + + private String username; + + private String firstName; + + private String lastName; + + private String email; + + private String password; + + private String phone; + + /** + * User Status + **/ + private Integer userStatus; + + /** + * Get id + * @return id + **/ + @JsonbProperty("id") + public Long getId() { + return id; + } + + /** + * Set id + **/ + public void setId(Long id) { + this.id = id; + } + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get username + * @return username + **/ + @JsonbProperty("username") + public String getUsername() { + return username; + } + + /** + * Set username + **/ + public void setUsername(String username) { + this.username = username; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @JsonbProperty("firstName") + public String getFirstName() { + return firstName; + } + + /** + * Set firstName + **/ + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @JsonbProperty("lastName") + public String getLastName() { + return lastName; + } + + /** + * Set lastName + **/ + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get email + * @return email + **/ + @JsonbProperty("email") + public String getEmail() { + return email; + } + + /** + * Set email + **/ + public void setEmail(String email) { + this.email = email; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get password + * @return password + **/ + @JsonbProperty("password") + public String getPassword() { + return password; + } + + /** + * Set password + **/ + public void setPassword(String password) { + this.password = password; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get phone + * @return phone + **/ + @JsonbProperty("phone") + public String getPhone() { + return phone; + } + + /** + * Set phone + **/ + public void setPhone(String phone) { + this.phone = phone; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @JsonbProperty("userStatus") + public Integer getUserStatus() { + return userStatus; + } + + /** + * Set userStatus + **/ + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 00000000000..66bd3d64deb --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,204 @@ +/** + * 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. + * + * 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.client.api; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; + +import java.net.URL; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + +/** + * OpenAPI Petstore Test + * + * API tests for PetApi + */ +public class PetApiTest { + + private PetApi client; + private String baseUrl = "http://localhost:9080"; + + @Before + public void setup() throws MalformedURLException { + client = RestClientBuilder.newBuilder() + .baseUrl(new URL(baseUrl)) + .register(ApiException.class) + .build(PetApi.class); + } + + + /** + * Add a new pet to the store + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() { + // TODO: test validations + Pet body = null; + //void response = api.addPet(body); + //assertNotNull(response); + + + } + + /** + * Deletes a pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() { + // TODO: test validations + Long petId = null; + String apiKey = null; + //void response = api.deletePet(petId, apiKey); + //assertNotNull(response); + + + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() { + // TODO: test validations + List status = null; + //List response = api.findPetsByStatus(status); + //assertNotNull(response); + + + } + + /** + * 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 + public void findPetsByTagsTest() { + // TODO: test validations + List tags = null; + //List response = api.findPetsByTags(tags); + //assertNotNull(response); + + + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() { + // TODO: test validations + Long petId = null; + //Pet response = api.getPetById(petId); + //assertNotNull(response); + + + } + + /** + * Update an existing pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() { + // TODO: test validations + Pet body = null; + //void response = api.updatePet(body); + //assertNotNull(response); + + + } + + /** + * Updates a pet in the store with form data + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() { + // TODO: test validations + Long petId = null; + String name = null; + String status = null; + //void response = api.updatePetWithForm(petId, name, status); + //assertNotNull(response); + + + } + + /** + * uploads an image + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() { + // TODO: test validations + Long petId = null; + String additionalMetadata = null; + org.apache.cxf.jaxrs.ext.multipart.Attachment file = null; + //ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + //assertNotNull(response); + + + } + +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 00000000000..386ef568b4c --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,132 @@ +/** + * 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. + * + * 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.client.api; + +import org.openapitools.client.model.Order; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; + +import java.net.URL; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + +/** + * OpenAPI Petstore Test + * + * API tests for StoreApi + */ +public class StoreApiTest { + + private StoreApi client; + private String baseUrl = "http://localhost:9080"; + + @Before + public void setup() throws MalformedURLException { + client = RestClientBuilder.newBuilder() + .baseUrl(new URL(baseUrl)) + .register(ApiException.class) + .build(StoreApi.class); + } + + + /** + * 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 + public void deleteOrderTest() { + // TODO: test validations + String orderId = null; + //void response = api.deleteOrder(orderId); + //assertNotNull(response); + + + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() { + // TODO: test validations + //Map response = api.getInventory(); + //assertNotNull(response); + + + } + + /** + * 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 + public void getOrderByIdTest() { + // TODO: test validations + Long orderId = null; + //Order response = api.getOrderById(orderId); + //assertNotNull(response); + + + } + + /** + * Place an order for a pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() { + // TODO: test validations + Order body = null; + //Order response = api.placeOrder(body); + //assertNotNull(response); + + + } + +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 00000000000..cb97ab79276 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,198 @@ +/** + * 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. + * + * 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.client.api; + +import org.openapitools.client.model.User; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; + +import java.net.URL; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + +/** + * OpenAPI Petstore Test + * + * API tests for UserApi + */ +public class UserApiTest { + + private UserApi client; + private String baseUrl = "http://localhost:9080"; + + @Before + public void setup() throws MalformedURLException { + client = RestClientBuilder.newBuilder() + .baseUrl(new URL(baseUrl)) + .register(ApiException.class) + .build(UserApi.class); + } + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() { + // TODO: test validations + User body = null; + //void response = api.createUser(body); + //assertNotNull(response); + + + } + + /** + * Creates list of users with given input array + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() { + // TODO: test validations + List body = null; + //void response = api.createUsersWithArrayInput(body); + //assertNotNull(response); + + + } + + /** + * Creates list of users with given input array + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() { + // TODO: test validations + List body = null; + //void response = api.createUsersWithListInput(body); + //assertNotNull(response); + + + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() { + // TODO: test validations + String username = null; + //void response = api.deleteUser(username); + //assertNotNull(response); + + + } + + /** + * Get user by user name + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() { + // TODO: test validations + String username = null; + //User response = api.getUserByName(username); + //assertNotNull(response); + + + } + + /** + * Logs user into the system + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() { + // TODO: test validations + String username = null; + String password = null; + //String response = api.loginUser(username, password); + //assertNotNull(response); + + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() { + // TODO: test validations + //void response = api.logoutUser(); + //assertNotNull(response); + + + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() { + // TODO: test validations + String username = null; + User body = null; + //void response = api.updateUser(username, body); + //assertNotNull(response); + + + } + +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 00000000000..33fc7ef96f7 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,63 @@ +/** + * 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. + * + * 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.client.model; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 00000000000..2811b988a45 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,71 @@ +/** + * 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. + * + * 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.client.model; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 00000000000..e8989d64a87 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,96 @@ +/** + * 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. + * + * 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.client.model; + +import java.util.Date; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 00000000000..f0db425f497 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,99 @@ +/** + * 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. + * + * 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.client.model; + +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 00000000000..4b86da39763 --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,63 @@ +/** + * 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. + * + * 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.client.model; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 00000000000..c4b7e13a9fd --- /dev/null +++ b/samples/client/petstore/java/microprofile-rest-client/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,111 @@ +/** + * 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. + * + * 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.client.model; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf016b..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties index b0acbdcd73b..94920145f34 100644 --- a/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/native/gradlew b/samples/client/petstore/java/native/gradlew index 8e25e6c19d5..2fe81a7d95e 100644 --- a/samples/client/petstore/java/native/gradlew +++ b/samples/client/petstore/java/native/gradlew @@ -125,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -154,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -175,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/okhttp-gson/gradlew b/samples/client/petstore/java/okhttp-gson/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/okhttp-gson/gradlew +++ b/samples/client/petstore/java/okhttp-gson/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/okhttp-gson/gradlew.bat b/samples/client/petstore/java/okhttp-gson/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/okhttp-gson/gradlew.bat +++ b/samples/client/petstore/java/okhttp-gson/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/rest-assured/gradlew b/samples/client/petstore/java/rest-assured/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/rest-assured/gradlew +++ b/samples/client/petstore/java/rest-assured/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/rest-assured/gradlew.bat b/samples/client/petstore/java/rest-assured/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/rest-assured/gradlew.bat +++ b/samples/client/petstore/java/rest-assured/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index cc52d202adf..92bc2746fd4 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -57,6 +57,11 @@ public class AnotherFakeApi { return reqSpec; } + public List getAllOperations() { + return Arrays.asList( + call123testSpecialTags() + ); + } @ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", @@ -85,7 +90,7 @@ public class AnotherFakeApi { * @see #body client model (required) * return Client */ - public static class Call123testSpecialTagsOper { + public static class Call123testSpecialTagsOper implements Oper { public static final Method REQ_METHOD = PATCH; public static final String REQ_URI = "/another-fake/dummy"; @@ -106,6 +111,7 @@ public class AnotherFakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java index 543cb0c4295..87f00fcd212 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java @@ -65,6 +65,24 @@ public class FakeApi { return reqSpec; } + public List getAllOperations() { + return Arrays.asList( + createXmlItem(), + fakeOuterBooleanSerialize(), + fakeOuterCompositeSerialize(), + fakeOuterNumberSerialize(), + fakeOuterStringSerialize(), + testBodyWithFileSchema(), + testBodyWithQueryParams(), + testClientModel(), + testEndpointParameters(), + testEnumParameters(), + testGroupParameters(), + testInlineAdditionalProperties(), + testJsonFormData(), + testQueryParameterCollectionFormat() + ); + } @ApiOperation(value = "creates an XmlItem", notes = "this route creates an XmlItem", @@ -224,7 +242,7 @@ public class FakeApi { * * @see #body XmlItem Body (required) */ - public static class CreateXmlItemOper { + public static class CreateXmlItemOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/fake/create_xml_item"; @@ -245,6 +263,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -285,7 +304,7 @@ public class FakeApi { * @see #body Input boolean as post body (optional) * return Boolean */ - public static class FakeOuterBooleanSerializeOper { + public static class FakeOuterBooleanSerializeOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/fake/outer/boolean"; @@ -306,6 +325,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -356,7 +376,7 @@ public class FakeApi { * @see #body Input composite as post body (optional) * return OuterComposite */ - public static class FakeOuterCompositeSerializeOper { + public static class FakeOuterCompositeSerializeOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/fake/outer/composite"; @@ -377,6 +397,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -427,7 +448,7 @@ public class FakeApi { * @see #body Input number as post body (optional) * return BigDecimal */ - public static class FakeOuterNumberSerializeOper { + public static class FakeOuterNumberSerializeOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/fake/outer/number"; @@ -448,6 +469,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -498,7 +520,7 @@ public class FakeApi { * @see #body Input string as post body (optional) * return String */ - public static class FakeOuterStringSerializeOper { + public static class FakeOuterStringSerializeOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/fake/outer/string"; @@ -519,6 +541,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -568,7 +591,7 @@ public class FakeApi { * * @see #body (required) */ - public static class TestBodyWithFileSchemaOper { + public static class TestBodyWithFileSchemaOper implements Oper { public static final Method REQ_METHOD = PUT; public static final String REQ_URI = "/fake/body-with-file-schema"; @@ -589,6 +612,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -629,7 +653,7 @@ public class FakeApi { * @see #queryQuery (required) * @see #body (required) */ - public static class TestBodyWithQueryParamsOper { + public static class TestBodyWithQueryParamsOper implements Oper { public static final Method REQ_METHOD = PUT; public static final String REQ_URI = "/fake/body-with-query-params"; @@ -650,6 +674,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -701,7 +726,7 @@ public class FakeApi { * @see #body client model (required) * return Client */ - public static class TestClientModelOper { + public static class TestClientModelOper implements Oper { public static final Method REQ_METHOD = PATCH; public static final String REQ_URI = "/fake"; @@ -722,6 +747,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -784,7 +810,7 @@ public class FakeApi { * @see #passwordForm None (optional) * @see #paramCallbackForm None (optional) */ - public static class TestEndpointParametersOper { + public static class TestEndpointParametersOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/fake"; @@ -805,6 +831,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -996,7 +1023,7 @@ public class FakeApi { * @see #enumFormStringArrayForm Form parameter enum test (string array) (optional, default to $) * @see #enumFormStringForm Form parameter enum test (string) (optional, default to -efg) */ - public static class TestEnumParametersOper { + public static class TestEnumParametersOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/fake"; @@ -1017,6 +1044,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -1140,7 +1168,7 @@ public class FakeApi { * @see #booleanGroupHeader Boolean in group parameters (optional) * @see #int64GroupQuery Integer in group parameters (optional) */ - public static class TestGroupParametersOper { + public static class TestGroupParametersOper implements Oper { public static final Method REQ_METHOD = DELETE; public static final String REQ_URI = "/fake"; @@ -1160,6 +1188,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -1256,7 +1285,7 @@ public class FakeApi { * * @see #body request body (required) */ - public static class TestInlineAdditionalPropertiesOper { + public static class TestInlineAdditionalPropertiesOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/fake/inline-additionalProperties"; @@ -1277,6 +1306,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -1317,7 +1347,7 @@ public class FakeApi { * @see #paramForm field1 (required) * @see #param2Form field2 (required) */ - public static class TestJsonFormDataOper { + public static class TestJsonFormDataOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/fake/jsonFormData"; @@ -1338,6 +1368,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -1394,7 +1425,7 @@ public class FakeApi { * @see #urlQuery (required) * @see #contextQuery (required) */ - public static class TestQueryParameterCollectionFormatOper { + public static class TestQueryParameterCollectionFormatOper implements Oper { public static final Method REQ_METHOD = PUT; public static final String REQ_URI = "/fake/test-query-paramters"; @@ -1414,6 +1445,7 @@ public class FakeApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index aff1931bb82..48ebc5b102f 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -57,6 +57,11 @@ public class FakeClassnameTags123Api { return reqSpec; } + public List getAllOperations() { + return Arrays.asList( + testClassname() + ); + } @ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", @@ -85,7 +90,7 @@ public class FakeClassnameTags123Api { * @see #body client model (required) * return Client */ - public static class TestClassnameOper { + public static class TestClassnameOper implements Oper { public static final Method REQ_METHOD = PATCH; public static final String REQ_URI = "/fake_classname_test"; @@ -106,6 +111,7 @@ public class FakeClassnameTags123Api { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/Oper.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/Oper.java new file mode 100644 index 00000000000..d9a11e71466 --- /dev/null +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/Oper.java @@ -0,0 +1,24 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import io.restassured.response.Response; + +import java.util.function.Function; + +public interface Oper { + + T execute(Function handler); + +} diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java index 4ffbfa3bcac..fee22f69f3c 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java @@ -59,6 +59,19 @@ public class PetApi { return reqSpec; } + public List getAllOperations() { + return Arrays.asList( + addPet(), + deletePet(), + findPetsByStatus(), + findPetsByTags(), + getPetById(), + updatePet(), + updatePetWithForm(), + uploadFile(), + uploadFileWithRequiredFile() + ); + } @ApiOperation(value = "Add a new pet to the store", notes = "", @@ -176,7 +189,7 @@ public class PetApi { * * @see #body Pet object that needs to be added to the store (required) */ - public static class AddPetOper { + public static class AddPetOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/pet"; @@ -197,6 +210,7 @@ public class PetApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -237,7 +251,7 @@ public class PetApi { * @see #petIdPath Pet id to delete (required) * @see #apiKeyHeader (optional) */ - public static class DeletePetOper { + public static class DeletePetOper implements Oper { public static final Method REQ_METHOD = DELETE; public static final String REQ_URI = "/pet/{petId}"; @@ -257,6 +271,7 @@ public class PetApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -310,7 +325,7 @@ public class PetApi { * @see #statusQuery Status values that need to be considered for filter (required) * return List<Pet> */ - public static class FindPetsByStatusOper { + public static class FindPetsByStatusOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/pet/findByStatus"; @@ -330,6 +345,7 @@ public class PetApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -384,7 +400,7 @@ public class PetApi { * @deprecated */ @Deprecated - public static class FindPetsByTagsOper { + public static class FindPetsByTagsOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/pet/findByTags"; @@ -404,6 +420,7 @@ public class PetApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -456,7 +473,7 @@ public class PetApi { * @see #petIdPath ID of pet to return (required) * return Pet */ - public static class GetPetByIdOper { + public static class GetPetByIdOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/pet/{petId}"; @@ -476,6 +493,7 @@ public class PetApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -527,7 +545,7 @@ public class PetApi { * * @see #body Pet object that needs to be added to the store (required) */ - public static class UpdatePetOper { + public static class UpdatePetOper implements Oper { public static final Method REQ_METHOD = PUT; public static final String REQ_URI = "/pet"; @@ -548,6 +566,7 @@ public class PetApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -589,7 +608,7 @@ public class PetApi { * @see #nameForm Updated name of the pet (optional) * @see #statusForm Updated status of the pet (optional) */ - public static class UpdatePetWithFormOper { + public static class UpdatePetWithFormOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/pet/{petId}"; @@ -610,6 +629,7 @@ public class PetApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -676,7 +696,7 @@ public class PetApi { * @see #fileMultiPart file to upload (optional) * return ModelApiResponse */ - public static class UploadFileOper { + public static class UploadFileOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/pet/{petId}/uploadImage"; @@ -697,6 +717,7 @@ public class PetApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -773,7 +794,7 @@ public class PetApi { * @see #additionalMetadataForm Additional data to pass to server (optional) * return ModelApiResponse */ - public static class UploadFileWithRequiredFileOper { + public static class UploadFileWithRequiredFileOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/fake/{petId}/uploadImageWithRequiredFile"; @@ -794,6 +815,7 @@ public class PetApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java index 9ba5cec8cdb..c6118ae91fe 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java @@ -57,6 +57,14 @@ public class StoreApi { return reqSpec; } + public List getAllOperations() { + return Arrays.asList( + deleteOrder(), + getInventory(), + getOrderById(), + placeOrder() + ); + } @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", @@ -118,7 +126,7 @@ public class StoreApi { * * @see #orderIdPath ID of the order that needs to be deleted (required) */ - public static class DeleteOrderOper { + public static class DeleteOrderOper implements Oper { public static final Method REQ_METHOD = DELETE; public static final String REQ_URI = "/store/order/{order_id}"; @@ -138,6 +146,7 @@ public class StoreApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -179,7 +188,7 @@ public class StoreApi { * * return Map<String, Integer> */ - public static class GetInventoryOper { + public static class GetInventoryOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/store/inventory"; @@ -199,6 +208,7 @@ public class StoreApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -240,7 +250,7 @@ public class StoreApi { * @see #orderIdPath ID of pet that needs to be fetched (required) * return Order */ - public static class GetOrderByIdOper { + public static class GetOrderByIdOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/store/order/{order_id}"; @@ -260,6 +270,7 @@ public class StoreApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -312,7 +323,7 @@ public class StoreApi { * @see #body order placed for purchasing the pet (required) * return Order */ - public static class PlaceOrderOper { + public static class PlaceOrderOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/store/order"; @@ -333,6 +344,7 @@ public class StoreApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java index 38c921afb99..4b2ee75cb92 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java @@ -57,6 +57,18 @@ public class UserApi { return reqSpec; } + public List getAllOperations() { + return Arrays.asList( + createUser(), + createUsersWithArrayInput(), + createUsersWithListInput(), + deleteUser(), + getUserByName(), + loginUser(), + logoutUser(), + updateUser() + ); + } @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", @@ -159,7 +171,7 @@ public class UserApi { * * @see #body Created user object (required) */ - public static class CreateUserOper { + public static class CreateUserOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/user"; @@ -180,6 +192,7 @@ public class UserApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -219,7 +232,7 @@ public class UserApi { * * @see #body List of user object (required) */ - public static class CreateUsersWithArrayInputOper { + public static class CreateUsersWithArrayInputOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/user/createWithArray"; @@ -240,6 +253,7 @@ public class UserApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -279,7 +293,7 @@ public class UserApi { * * @see #body List of user object (required) */ - public static class CreateUsersWithListInputOper { + public static class CreateUsersWithListInputOper implements Oper { public static final Method REQ_METHOD = POST; public static final String REQ_URI = "/user/createWithList"; @@ -300,6 +314,7 @@ public class UserApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -339,7 +354,7 @@ public class UserApi { * * @see #usernamePath The name that needs to be deleted (required) */ - public static class DeleteUserOper { + public static class DeleteUserOper implements Oper { public static final Method REQ_METHOD = DELETE; public static final String REQ_URI = "/user/{username}"; @@ -359,6 +374,7 @@ public class UserApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -401,7 +417,7 @@ public class UserApi { * @see #usernamePath The name that needs to be fetched. Use user1 for testing. (required) * return User */ - public static class GetUserByNameOper { + public static class GetUserByNameOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/user/{username}"; @@ -421,6 +437,7 @@ public class UserApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -474,7 +491,7 @@ public class UserApi { * @see #passwordQuery The password for login in clear text (required) * return String */ - public static class LoginUserOper { + public static class LoginUserOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/user/login"; @@ -494,6 +511,7 @@ public class UserApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -555,7 +573,7 @@ public class UserApi { * * */ - public static class LogoutUserOper { + public static class LogoutUserOper implements Oper { public static final Method REQ_METHOD = GET; public static final String REQ_URI = "/user/logout"; @@ -575,6 +593,7 @@ public class UserApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } @@ -606,7 +625,7 @@ public class UserApi { * @see #usernamePath name that need to be deleted (required) * @see #body Updated user object (required) */ - public static class UpdateUserOper { + public static class UpdateUserOper implements Oper { public static final Method REQ_METHOD = PUT; public static final String REQ_URI = "/user/{username}"; @@ -627,6 +646,7 @@ public class UserApi { * @param type * @return type */ + @Override public T execute(Function handler) { return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI)); } diff --git a/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/resteasy/gradlew b/samples/client/petstore/java/resteasy/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/resteasy/gradlew +++ b/samples/client/petstore/java/resteasy/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/resteasy/gradlew.bat b/samples/client/petstore/java/resteasy/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/resteasy/gradlew.bat +++ b/samples/client/petstore/java/resteasy/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/resttemplate-withXml/gradlew b/samples/client/petstore/java/resttemplate-withXml/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/resttemplate-withXml/gradlew +++ b/samples/client/petstore/java/resttemplate-withXml/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/resttemplate-withXml/gradlew.bat b/samples/client/petstore/java/resttemplate-withXml/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/resttemplate-withXml/gradlew.bat +++ b/samples/client/petstore/java/resttemplate-withXml/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/resttemplate/gradlew b/samples/client/petstore/java/resttemplate/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/resttemplate/gradlew +++ b/samples/client/petstore/java/resttemplate/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/resttemplate/gradlew.bat b/samples/client/petstore/java/resttemplate/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/resttemplate/gradlew.bat +++ b/samples/client/petstore/java/resttemplate/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit/gradlew b/samples/client/petstore/java/retrofit/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/retrofit/gradlew +++ b/samples/client/petstore/java/retrofit/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/retrofit/gradlew.bat b/samples/client/petstore/java/retrofit/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/retrofit/gradlew.bat +++ b/samples/client/petstore/java/retrofit/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2-play24/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2-play24/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/retrofit2-play24/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2-play24/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2-play24/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2-play24/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/retrofit2-play24/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2-play24/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2-play24/gradlew b/samples/client/petstore/java/retrofit2-play24/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/retrofit2-play24/gradlew +++ b/samples/client/petstore/java/retrofit2-play24/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/retrofit2-play24/gradlew.bat b/samples/client/petstore/java/retrofit2-play24/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/retrofit2-play24/gradlew.bat +++ b/samples/client/petstore/java/retrofit2-play24/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2-play25/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2-play25/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/retrofit2-play25/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2-play25/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2-play25/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2-play25/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/retrofit2-play25/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2-play25/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2-play25/gradlew b/samples/client/petstore/java/retrofit2-play25/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/retrofit2-play25/gradlew +++ b/samples/client/petstore/java/retrofit2-play25/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/retrofit2-play25/gradlew.bat b/samples/client/petstore/java/retrofit2-play25/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/retrofit2-play25/gradlew.bat +++ b/samples/client/petstore/java/retrofit2-play25/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2-play26/gradlew b/samples/client/petstore/java/retrofit2-play26/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/retrofit2-play26/gradlew +++ b/samples/client/petstore/java/retrofit2-play26/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/retrofit2-play26/gradlew.bat b/samples/client/petstore/java/retrofit2-play26/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/retrofit2-play26/gradlew.bat +++ b/samples/client/petstore/java/retrofit2-play26/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2/gradlew b/samples/client/petstore/java/retrofit2/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/retrofit2/gradlew +++ b/samples/client/petstore/java/retrofit2/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/retrofit2/gradlew.bat b/samples/client/petstore/java/retrofit2/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/retrofit2/gradlew.bat +++ b/samples/client/petstore/java/retrofit2/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2rx/gradlew b/samples/client/petstore/java/retrofit2rx/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/retrofit2rx/gradlew +++ b/samples/client/petstore/java/retrofit2rx/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/retrofit2rx/gradlew.bat b/samples/client/petstore/java/retrofit2rx/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/retrofit2rx/gradlew.bat +++ b/samples/client/petstore/java/retrofit2rx/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2rx2/gradlew b/samples/client/petstore/java/retrofit2rx2/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/retrofit2rx2/gradlew +++ b/samples/client/petstore/java/retrofit2rx2/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/retrofit2rx2/gradlew.bat b/samples/client/petstore/java/retrofit2rx2/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/retrofit2rx2/gradlew.bat +++ b/samples/client/petstore/java/retrofit2rx2/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/vertx/gradlew b/samples/client/petstore/java/vertx/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/vertx/gradlew +++ b/samples/client/petstore/java/vertx/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/vertx/gradlew.bat b/samples/client/petstore/java/vertx/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/vertx/gradlew.bat +++ b/samples/client/petstore/java/vertx/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..cc4fdc293d0 100644 Binary files a/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.properties index e496c054f69..94920145f34 100644 --- a/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/webclient/gradlew b/samples/client/petstore/java/webclient/gradlew index af6708ff229..2fe81a7d95e 100644 --- a/samples/client/petstore/java/webclient/gradlew +++ b/samples/client/petstore/java/webclient/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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/samples/client/petstore/java/webclient/gradlew.bat b/samples/client/petstore/java/webclient/gradlew.bat index f9553162f12..9618d8d9607 100644 --- a/samples/client/petstore/java/webclient/gradlew.bat +++ b/samples/client/petstore/java/webclient/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java index 776694a8b87..6ace9f2a182 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java @@ -493,7 +493,7 @@ public class ApiClient { formParams .toSingleValueMap() .entrySet() - .forEach(es -> map.add(es.getKey(), (String) es.getValue())); + .forEach(es -> map.add(es.getKey(), String.valueOf(es.getValue()))); return BodyInserters.fromFormData(map); } else if(MediaType.MULTIPART_FORM_DATA.equals(contentType)) { @@ -634,6 +634,28 @@ public class ApiClient { } } + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param values The values of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(CollectionFormat collectionFormat, Collection values) { + // create the value based on the collection format + if (CollectionFormat.MULTI.equals(collectionFormat)) { + // not valid for path params + return parameterToString(values); + } + + // collectionFormat is assumed to be "csv" by default + if(collectionFormat == null) { + collectionFormat = CollectionFormat.CSV; + } + + return collectionFormat.collectionToString(values); + } + private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor { private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 202d239489f..1b7f76e019b 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -64,6 +64,7 @@ public class AnotherFakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java index 25423c5bb27..fcbe10439e9 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -71,6 +71,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -102,6 +103,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -133,6 +135,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -164,6 +167,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -195,6 +199,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -230,6 +235,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -271,6 +277,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -309,6 +316,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -375,6 +383,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -442,6 +451,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -507,6 +517,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -550,6 +561,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -591,6 +603,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -655,6 +668,7 @@ public class FakeApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index b6f694ab5f3..35c54dd0fc6 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -64,6 +64,7 @@ public class FakeClassnameTags123Api { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java index d1b34d105c2..079890b3a06 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -66,6 +66,7 @@ public class PetApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -104,6 +105,7 @@ public class PetApi { final Map pathParams = new HashMap(); pathParams.put("petId", petId); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -142,6 +144,7 @@ public class PetApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -181,6 +184,7 @@ public class PetApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -222,6 +226,7 @@ public class PetApi { final Map pathParams = new HashMap(); pathParams.put("petId", petId); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -260,6 +265,7 @@ public class PetApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -298,6 +304,7 @@ public class PetApi { final Map pathParams = new HashMap(); pathParams.put("petId", petId); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -342,6 +349,7 @@ public class PetApi { final Map pathParams = new HashMap(); pathParams.put("petId", petId); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -393,6 +401,7 @@ public class PetApi { final Map pathParams = new HashMap(); pathParams.put("petId", petId); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java index 364767217b6..232dd361d2c 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java @@ -65,6 +65,7 @@ public class StoreApi { final Map pathParams = new HashMap(); pathParams.put("order_id", orderId); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -93,6 +94,7 @@ public class StoreApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -132,6 +134,7 @@ public class StoreApi { final Map pathParams = new HashMap(); pathParams.put("order_id", orderId); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -169,6 +172,7 @@ public class StoreApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java index d884b800a38..28023c26f31 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java @@ -63,6 +63,7 @@ public class UserApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -96,6 +97,7 @@ public class UserApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -129,6 +131,7 @@ public class UserApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -164,6 +167,7 @@ public class UserApi { final Map pathParams = new HashMap(); pathParams.put("username", username); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -201,6 +205,7 @@ public class UserApi { final Map pathParams = new HashMap(); pathParams.put("username", username); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -244,6 +249,7 @@ public class UserApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -276,6 +282,7 @@ public class UserApi { // create path and map variables final Map pathParams = new HashMap(); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); @@ -317,6 +324,7 @@ public class UserApi { final Map pathParams = new HashMap(); pathParams.put("username", username); + final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); diff --git a/samples/client/petstore/javascript-flowtyped/lib/api.js b/samples/client/petstore/javascript-flowtyped/lib/api.js index e0ed087f022..355d4f70e0e 100644 --- a/samples/client/petstore/javascript-flowtyped/lib/api.js +++ b/samples/client/petstore/javascript-flowtyped/lib/api.js @@ -1,8 +1,8 @@ -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"; +import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; +import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/esm/inherits"; +import _wrapNativeSuper from "@babel/runtime/helpers/esm/wrapNativeSuper"; /* eslint-disable no-use-before-define */ diff --git a/samples/client/petstore/javascript-flowtyped/lib/configuration.js b/samples/client/petstore/javascript-flowtyped/lib/configuration.js index f1670e52540..7fc6d50bce9 100644 --- a/samples/client/petstore/javascript-flowtyped/lib/configuration.js +++ b/samples/client/petstore/javascript-flowtyped/lib/configuration.js @@ -1,4 +1,4 @@ -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 _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; /** * OpenAPI Petstore diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ca294b411c8..b397f322247 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -1,5 +1,6 @@ package org.openapitools.client.infrastructure +import okhttp3.Credentials import okhttp3.OkHttpClient import okhttp3.RequestBody import okhttp3.RequestBody.Companion.asRequestBody diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 3b6246b9ee4..e9201e8a2a9 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -1,5 +1,6 @@ package org.openapitools.client.infrastructure +import okhttp3.Credentials import okhttp3.OkHttpClient import okhttp3.RequestBody import okhttp3.RequestBody.Companion.asRequestBody diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 443c18a8353..7a83b73f51c 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -1,5 +1,6 @@ package org.openapitools.client.infrastructure +import okhttp3.Credentials import okhttp3.OkHttpClient import okhttp3.RequestBody import okhttp3.RequestBody.Companion.asRequestBody diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 3eb74d9ddfc..162f8d23473 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -1,5 +1,6 @@ package org.openapitools.client.infrastructure +import okhttp3.Credentials import okhttp3.OkHttpClient import okhttp3.RequestBody import okhttp3.MediaType diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 443c18a8353..7a83b73f51c 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -1,5 +1,6 @@ package org.openapitools.client.infrastructure +import okhttp3.Credentials import okhttp3.OkHttpClient import okhttp3.RequestBody import okhttp3.RequestBody.Companion.asRequestBody diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 443c18a8353..7a83b73f51c 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -1,5 +1,6 @@ package org.openapitools.client.infrastructure +import okhttp3.Credentials import okhttp3.OkHttpClient import okhttp3.RequestBody import okhttp3.RequestBody.Companion.asRequestBody diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 443c18a8353..7a83b73f51c 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -1,5 +1,6 @@ package org.openapitools.client.infrastructure +import okhttp3.Credentials import okhttp3.OkHttpClient import okhttp3.RequestBody import okhttp3.RequestBody.Companion.asRequestBody diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index 30e6dfe67aa..b3c8c1773cc 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -156,7 +156,7 @@ class AnotherFakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -181,7 +181,7 @@ class AnotherFakeApi if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -196,7 +196,7 @@ class AnotherFakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -263,7 +263,7 @@ class AnotherFakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 9c61ac95f7c..f22d9c13366 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -155,7 +155,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -371,7 +371,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -396,7 +396,7 @@ class FakeApi if ('bool' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -411,7 +411,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -478,7 +478,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -628,7 +628,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -653,7 +653,7 @@ class FakeApi if ('\OpenAPI\Client\Model\OuterComposite' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -668,7 +668,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -735,7 +735,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -885,7 +885,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -910,7 +910,7 @@ class FakeApi if ('float' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -925,7 +925,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -992,7 +992,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1142,7 +1142,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1167,7 +1167,7 @@ class FakeApi if ('string' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1182,7 +1182,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1249,7 +1249,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1398,7 +1398,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1615,7 +1615,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1848,7 +1848,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1873,7 +1873,7 @@ class FakeApi if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1888,7 +1888,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1955,7 +1955,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2140,7 +2140,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -2535,7 +2535,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -2818,7 +2818,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -3099,7 +3099,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -3320,7 +3320,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -3557,7 +3557,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index 1b91938ffa5..a2cb42434a0 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -156,7 +156,7 @@ class FakeClassnameTags123Api "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -181,7 +181,7 @@ class FakeClassnameTags123Api if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -196,7 +196,7 @@ class FakeClassnameTags123Api if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -263,7 +263,7 @@ class FakeClassnameTags123Api if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index e7293c4ec87..103df8777e6 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -155,7 +155,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -380,7 +380,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -616,7 +616,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -641,7 +641,7 @@ class PetApi if ('\OpenAPI\Client\Model\Pet[]' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -656,7 +656,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -723,7 +723,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -891,7 +891,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -916,7 +916,7 @@ class PetApi if ('\OpenAPI\Client\Model\Pet[]' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -931,7 +931,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -998,7 +998,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1166,7 +1166,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1191,7 +1191,7 @@ class PetApi if ('\OpenAPI\Client\Model\Pet' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1206,7 +1206,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1273,7 +1273,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1442,7 +1442,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1669,7 +1669,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1916,7 +1916,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1941,7 +1941,7 @@ class PetApi if ('\OpenAPI\Client\Model\ApiResponse' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1956,7 +1956,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2027,7 +2027,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2211,7 +2211,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -2236,7 +2236,7 @@ class PetApi if ('\OpenAPI\Client\Model\ApiResponse' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2251,7 +2251,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2322,7 +2322,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index 324df90cc52..9db892da894 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -155,7 +155,7 @@ class StoreApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -378,7 +378,7 @@ class StoreApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -403,7 +403,7 @@ class StoreApi if ('map[string,int]' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -418,7 +418,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -483,7 +483,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -638,7 +638,7 @@ class StoreApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -663,7 +663,7 @@ class StoreApi if ('\OpenAPI\Client\Model\Order' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -678,7 +678,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -745,7 +745,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -917,7 +917,7 @@ class StoreApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -942,7 +942,7 @@ class StoreApi if ('\OpenAPI\Client\Model\Order' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -957,7 +957,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1024,7 +1024,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index 1b32db09a86..ec1d6fb2665 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -155,7 +155,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -374,7 +374,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -593,7 +593,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -812,7 +812,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1037,7 +1037,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1062,7 +1062,7 @@ class UserApi if ('\OpenAPI\Client\Model\User' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1077,7 +1077,7 @@ class UserApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1144,7 +1144,7 @@ class UserApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1311,7 +1311,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1336,7 +1336,7 @@ class UserApi if ('string' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1351,7 +1351,7 @@ class UserApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1420,7 +1420,7 @@ class UserApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1589,7 +1589,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1798,7 +1798,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } diff --git a/samples/client/petstore/python-asyncio/.travis.yml b/samples/client/petstore/python-asyncio/.travis.yml index 86211e2d4a2..388de83128f 100644 --- a/samples/client/petstore/python-asyncio/.travis.yml +++ b/samples/client/petstore/python-asyncio/.travis.yml @@ -6,8 +6,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/samples/client/petstore/python-experimental/.travis.yml b/samples/client/petstore/python-experimental/.travis.yml index 86211e2d4a2..388de83128f 100644 --- a/samples/client/petstore/python-experimental/.travis.yml +++ b/samples/client/petstore/python-experimental/.travis.yml @@ -6,8 +6,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/samples/client/petstore/python-tornado/.travis.yml b/samples/client/petstore/python-tornado/.travis.yml index 86211e2d4a2..388de83128f 100644 --- a/samples/client/petstore/python-tornado/.travis.yml +++ b/samples/client/petstore/python-tornado/.travis.yml @@ -6,8 +6,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/samples/client/petstore/python/.travis.yml b/samples/client/petstore/python/.travis.yml index 86211e2d4a2..388de83128f 100644 --- a/samples/client/petstore/python/.travis.yml +++ b/samples/client/petstore/python/.travis.yml @@ -6,8 +6,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb b/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb index 4c733db3185..6d4679bf527 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb @@ -224,7 +224,7 @@ module Petstore [ { url: "http://petstore.swagger.io:80/v2", - description: "No descriptoin provided", + description: "No description provided", } ] end diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index ca4eb24ee9e..41055835cee 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -229,7 +229,7 @@ module Petstore [ { url: "http://petstore.swagger.io:80/v2", - description: "No descriptoin provided", + description: "No description provided", } ] end diff --git a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/PetApi.java index 577c619e939..89441e3da0c 100644 --- a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/PetApi.java @@ -34,6 +34,12 @@ import java.util.concurrent.CompletableFuture; @Api(value = "Pet", description = "the Pet API") public interface PetApi { + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return Invalid input (status code 405) + */ @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"), @@ -48,6 +54,13 @@ public interface PetApi { CompletableFuture> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -61,6 +74,14 @@ public interface PetApi { CompletableFuture> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -76,6 +97,15 @@ public interface PetApi { CompletableFuture>> 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) List status); + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -91,6 +121,15 @@ public interface PetApi { CompletableFuture>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -104,6 +143,14 @@ public interface PetApi { CompletableFuture> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId); + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -120,6 +167,14 @@ public interface PetApi { CompletableFuture> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -134,6 +189,14 @@ public interface PetApi { CompletableFuture> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet" ) @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet" ) @RequestParam(value="status", required=false) String status); + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -146,6 +209,6 @@ public interface PetApi { produces = "application/json", consumes = "multipart/form-data", method = RequestMethod.POST) - CompletableFuture> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server" ) @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestParam("file") MultipartFile file); + CompletableFuture> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server" ) @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @RequestParam("file") MultipartFile file); } diff --git a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/StoreApi.java index a82212b2fc6..1b340f927f7 100644 --- a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/StoreApi.java @@ -33,6 +33,14 @@ import java.util.concurrent.CompletableFuture; @Api(value = "Store", description = "the Store API") public interface StoreApi { + /** + * DELETE /store/order/{orderId} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -42,6 +50,12 @@ public interface StoreApi { CompletableFuture> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("orderId") String orderId); + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -53,6 +67,15 @@ public interface StoreApi { CompletableFuture>> getInventory(); + /** + * GET /store/order/{orderId} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -64,6 +87,13 @@ public interface StoreApi { CompletableFuture> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("orderId") Long orderId); + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/UserApi.java index d63c42087ae..28432005950 100644 --- a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/UserApi.java @@ -33,6 +33,13 @@ import java.util.concurrent.CompletableFuture; @Api(value = "User", description = "the User API") public interface UserApi { + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -41,6 +48,12 @@ public interface UserApi { CompletableFuture> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -49,6 +62,12 @@ public interface UserApi { CompletableFuture> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -57,6 +76,14 @@ public interface UserApi { CompletableFuture> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -66,6 +93,14 @@ public interface UserApi { CompletableFuture> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username); + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -77,6 +112,14 @@ public interface UserApi { CompletableFuture> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username); + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -87,6 +130,11 @@ public interface UserApi { CompletableFuture> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -95,6 +143,15 @@ public interface UserApi { CompletableFuture> logoutUser(); + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApi.java index 14717052607..aa1e994d4eb 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApi.java @@ -33,6 +33,12 @@ import java.util.Optional; @Api(value = "Pet", description = "the Pet API") public interface PetApi { + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return Invalid input (status code 405) + */ @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"), @@ -47,6 +53,13 @@ public interface PetApi { com.netflix.hystrix.HystrixCommand> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -60,6 +73,14 @@ public interface PetApi { com.netflix.hystrix.HystrixCommand> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -75,6 +96,15 @@ public interface PetApi { com.netflix.hystrix.HystrixCommand>> 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) List status); + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -90,6 +120,15 @@ public interface PetApi { com.netflix.hystrix.HystrixCommand>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -103,6 +142,14 @@ public interface PetApi { com.netflix.hystrix.HystrixCommand> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId); + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -119,6 +166,14 @@ public interface PetApi { com.netflix.hystrix.HystrixCommand> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -133,6 +188,14 @@ public interface PetApi { com.netflix.hystrix.HystrixCommand> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet" ) @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet" ) @RequestParam(value="status", required=false) String status); + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -145,6 +208,6 @@ public interface PetApi { produces = "application/json", consumes = "multipart/form-data", method = RequestMethod.POST) - com.netflix.hystrix.HystrixCommand> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server" ) @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestParam("file") MultipartFile file); + com.netflix.hystrix.HystrixCommand> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server" ) @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @RequestParam("file") MultipartFile file); } diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java index 3fa5a45bea2..6b4c08c3900 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java @@ -32,6 +32,14 @@ import java.util.Optional; @Api(value = "Store", description = "the Store API") public interface StoreApi { + /** + * DELETE /store/order/{orderId} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -41,6 +49,12 @@ public interface StoreApi { com.netflix.hystrix.HystrixCommand> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("orderId") String orderId); + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -52,6 +66,15 @@ public interface StoreApi { com.netflix.hystrix.HystrixCommand>> getInventory(); + /** + * GET /store/order/{orderId} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -63,6 +86,13 @@ public interface StoreApi { com.netflix.hystrix.HystrixCommand> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("orderId") Long orderId); + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java index fbbea575bcd..5fab9fdf7f7 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java @@ -32,6 +32,13 @@ import java.util.Optional; @Api(value = "User", description = "the User API") public interface UserApi { + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -40,6 +47,12 @@ public interface UserApi { com.netflix.hystrix.HystrixCommand> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -48,6 +61,12 @@ public interface UserApi { com.netflix.hystrix.HystrixCommand> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -56,6 +75,14 @@ public interface UserApi { com.netflix.hystrix.HystrixCommand> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -65,6 +92,14 @@ public interface UserApi { com.netflix.hystrix.HystrixCommand> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username); + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -76,6 +111,14 @@ public interface UserApi { com.netflix.hystrix.HystrixCommand> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username); + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -86,6 +129,11 @@ public interface UserApi { com.netflix.hystrix.HystrixCommand> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -94,6 +142,15 @@ public interface UserApi { com.netflix.hystrix.HystrixCommand> logoutUser(); + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/PetApi.java index 74a8d5ec3bb..e1665d676e4 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/PetApi.java @@ -37,6 +37,12 @@ public interface PetApi { return Optional.empty(); } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return Invalid input (status code 405) + */ @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"), @@ -54,6 +60,13 @@ public interface PetApi { } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -70,6 +83,14 @@ public interface PetApi { } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -102,6 +123,15 @@ public interface PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -134,6 +164,15 @@ public interface PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -164,6 +203,14 @@ public interface PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -183,6 +230,14 @@ public interface PetApi { } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -200,6 +255,14 @@ public interface PetApi { } + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -212,7 +275,7 @@ public interface PetApi { produces = "application/json", consumes = "multipart/form-data", method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java index 850857eb729..44a94de3d07 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java @@ -36,6 +36,14 @@ public interface StoreApi { return Optional.empty(); } + /** + * DELETE /store/order/{orderId} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -48,6 +56,12 @@ public interface StoreApi { } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -62,6 +76,15 @@ public interface StoreApi { } + /** + * GET /store/order/{orderId} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -90,6 +113,13 @@ public interface StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java index df7fcde7cce..745ad48bbca 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java @@ -36,6 +36,13 @@ public interface UserApi { return Optional.empty(); } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -47,6 +54,12 @@ public interface UserApi { } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -58,6 +71,12 @@ public interface UserApi { } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -69,6 +88,14 @@ public interface UserApi { } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -81,6 +108,14 @@ public interface UserApi { } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -109,6 +144,14 @@ public interface UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -122,6 +165,11 @@ public interface UserApi { } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -133,6 +181,15 @@ public interface UserApi { } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs.swift index 9e4312f685d..832282d224f 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -11,6 +11,7 @@ open class PetstoreClientAPI { public static var credential: URLCredential? public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() + public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder { diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 30b346de0e1..02e24286e3c 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class AnotherFakeAPI { /** diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d1f658b08d8..b0b394aa06e 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class FakeAPI { /** @@ -187,7 +186,7 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": query + "query": query.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -285,17 +284,17 @@ open class FakeAPI { "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), - "number": number, - "float": float, - "double": double, - "string": string, - "pattern_without_delimiter": patternWithoutDelimiter, - "byte": byte, - "binary": binary, + "number": number.encodeToJSON(), + "float": float?.encodeToJSON(), + "double": double.encodeToJSON(), + "string": string?.encodeToJSON(), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(), + "byte": byte.encodeToJSON(), + "binary": binary?.encodeToJSON(), "date": date?.encodeToJSON(), "dateTime": dateTime?.encodeToJSON(), - "password": password, - "callback": callback + "password": password?.encodeToJSON(), + "callback": callback?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -379,13 +378,13 @@ open class FakeAPI { To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - parameter completion: completion handler to receive the data and the error objects */ open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { @@ -403,21 +402,21 @@ open class FakeAPI { - GET /fake - To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: RequestBuilder */ open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray, - "enum_form_string": enumFormString?.rawValue + "enum_form_string_array": enumFormStringArray?.encodeToJSON(), + "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -425,14 +424,14 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray, - "enum_query_string": enumQueryString?.rawValue, - "enum_query_integer": enumQueryInteger?.rawValue, - "enum_query_double": enumQueryDouble?.rawValue + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "enum_header_string_array": enumHeaderStringArray, - "enum_header_string": enumHeaderString?.rawValue + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(), + "enum_header_string": enumHeaderString?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -487,8 +486,8 @@ open class FakeAPI { "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup, - "boolean_group": booleanGroup + "required_boolean_group": requiredBooleanGroup.encodeToJSON(), + "boolean_group": booleanGroup?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -559,8 +558,8 @@ open class FakeAPI { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "param": param, - "param2": param2 + "param": param.encodeToJSON(), + "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 6bfa09016f5..060d434fbf2 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class FakeClassnameTags123API { /** diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 39525475748..fe75962a72c 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class PetAPI { /** @@ -83,7 +82,7 @@ open class PetAPI { let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ - "api_key": apiKey + "api_key": apiKey?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -130,7 +129,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": status + "status": status.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -167,7 +166,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": tags + "tags": tags.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -285,8 +284,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "name": name, - "status": status + "name": name?.encodeToJSON(), + "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -331,8 +330,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "file": file + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -377,8 +376,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "requiredFile": requiredFile + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 98ff7b54742..d5f627df52a 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class StoreAPI { /** diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 24d0d35e9dd..ef4f971a91e 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class UserAPI { /** @@ -211,8 +210,8 @@ open class UserAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username, - "password": password + "username": username.encodeToJSON(), + "password": password.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index 60ce28c66a2..1d54e695608 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -156,7 +156,7 @@ open class AlamofireRequestBuilder: RequestBuilder { switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -176,7 +176,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) case is URL.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() do { @@ -226,7 +226,7 @@ open class AlamofireRequestBuilder: RequestBuilder { return }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -245,7 +245,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -358,7 +358,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -378,7 +378,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -397,7 +397,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Data.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -417,7 +417,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse: DataResponse) in cleanupRequest() guard dataResponse.result.isSuccess else { diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2fa32b9e0f3..f8faed255bf 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -5,7 +5,6 @@ // import Foundation -import Alamofire extension Bool: JSONEncodable { func encodeToJSON() -> Any { return self as Any } @@ -35,6 +34,10 @@ extension String: JSONEncodable { func encodeToJSON() -> Any { return self as Any } } +extension RawRepresentable where RawValue: JSONEncodable { + func encodeToJSON() -> Any { return self.rawValue as Any } +} + private func encodeIfPossible(_ object: T) -> Any { if let encodableObject = object as? JSONEncodable { return encodableObject.encodeToJSON() @@ -84,6 +87,12 @@ extension Date: JSONEncodable { } } +extension URL: JSONEncodable { + func encodeToJSON() -> Any { + return self + } +} + extension UUID: JSONEncodable { func encodeToJSON() -> Any { return self.uuidString diff --git a/samples/client/petstore/swift4/default/docs/FakeAPI.md b/samples/client/petstore/swift4/default/docs/FakeAPI.md index 18fbf8147d8..49d4d3fb6a1 100644 --- a/samples/client/petstore/swift4/default/docs/FakeAPI.md +++ b/samples/client/petstore/swift4/default/docs/FakeAPI.md @@ -453,13 +453,13 @@ To test enum parameters import PetstoreClient let enumHeaderStringArray = ["enumHeaderStringArray_example"] // [String] | Header parameter enum test (string array) (optional) -let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .-efg) +let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .efg) let enumQueryStringArray = ["enumQueryStringArray_example"] // [String] | Query parameter enum test (string array) (optional) -let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .-efg) +let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .efg) let enumQueryInteger = 987 // Int | Query parameter enum test (double) (optional) let enumQueryDouble = 987 // Double | Query parameter enum test (double) (optional) -let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .$) -let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .-efg) +let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .dollar) +let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .efg) // To test enum parameters FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString) { (response, error) in @@ -479,13 +479,13 @@ FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHea Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **enumHeaderStringArray** | [**[String]**](String.md) | Header parameter enum test (string array) | [optional] - **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .-efg] + **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .efg] **enumQueryStringArray** | [**[String]**](String.md) | Query parameter enum test (string array) | [optional] - **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .-efg] + **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .efg] **enumQueryInteger** | **Int** | Query parameter enum test (double) | [optional] **enumQueryDouble** | **Double** | Query parameter enum test (double) | [optional] - **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .$] - **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .-efg] + **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .dollar] + **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .efg] ### Return type diff --git a/samples/client/petstore/swift4/nonPublicApi/.gitignore b/samples/client/petstore/swift4/nonPublicApi/.gitignore new file mode 100644 index 00000000000..5e5d5cebcf4 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/.gitignore @@ -0,0 +1,63 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata + +## Other +*.xccheckout +*.moved-aside +*.xcuserstate +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md + +fastlane/report.xml +fastlane/screenshots diff --git a/samples/client/petstore/swift4/nonPublicApi/.openapi-generator-ignore b/samples/client/petstore/swift4/nonPublicApi/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/.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/client/petstore/swift4/nonPublicApi/.openapi-generator/VERSION b/samples/client/petstore/swift4/nonPublicApi/.openapi-generator/VERSION new file mode 100644 index 00000000000..e4955748d3e --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.2.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/nonPublicApi/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift4/nonPublicApi/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..919434a6254 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/samples/client/petstore/swift4/nonPublicApi/Cartfile b/samples/client/petstore/swift4/nonPublicApi/Cartfile new file mode 100644 index 00000000000..86748c63d90 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/Cartfile @@ -0,0 +1 @@ +github "Alamofire/Alamofire" ~> 4.9.0 diff --git a/samples/client/petstore/swift4/nonPublicApi/Info.plist b/samples/client/petstore/swift4/nonPublicApi/Info.plist new file mode 100644 index 00000000000..323e5ecfc42 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/samples/client/petstore/swift4/nonPublicApi/Package.resolved b/samples/client/petstore/swift4/nonPublicApi/Package.resolved new file mode 100644 index 00000000000..ca6137050eb --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "Alamofire", + "repositoryURL": "https://github.com/Alamofire/Alamofire.git", + "state": { + "branch": null, + "revision": "747c8db8d57b68d5e35275f10c92d55f982adbd4", + "version": "4.9.1" + } + } + ] + }, + "version": 1 +} diff --git a/samples/client/petstore/swift4/nonPublicApi/Package.swift b/samples/client/petstore/swift4/nonPublicApi/Package.swift new file mode 100644 index 00000000000..e5c5f0f33b8 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/Package.swift @@ -0,0 +1,27 @@ +// swift-tools-version:4.2 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "PetstoreClient", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "PetstoreClient", + targets: ["PetstoreClient"]) + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9.0") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "PetstoreClient", + dependencies: ["Alamofire"], + path: "PetstoreClient/Classes" + ) + ] +) diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.podspec b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.podspec new file mode 100644 index 00000000000..a6c9a1f3d45 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.podspec @@ -0,0 +1,14 @@ +Pod::Spec.new do |s| + s.name = 'PetstoreClient' + s.ios.deployment_target = '9.0' + s.osx.deployment_target = '10.11' + s.tvos.deployment_target = '9.0' + s.version = '1.0.0' + s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } + s.authors = '' + s.license = 'Proprietary' + s.homepage = 'https://github.com/openapitools/openapi-generator' + s.summary = 'PetstoreClient' + s.source_files = 'PetstoreClient/Classes/**/*.swift' + s.dependency 'Alamofire', '~> 4.9.0' +end diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..b606fe1ab10 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj @@ -0,0 +1,576 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 0299339D13C3571C4C57368A /* ApiResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */; }; + 081C0B80A989B1AAF2665121 /* MapTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7986861626C2B1CB49AD7000 /* MapTest.swift */; }; + 0C1E4C682F2D0AF7D9E431EE /* Dog.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6C3E1129526A353B963EFD7 /* Dog.swift */; }; + 0E6932F1C55BA6880693C478 /* Order.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B2E9EF856E89FEAA359A3A /* Order.swift */; }; + 1E6C7C7F271A802DF8099330 /* APIHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 897716962D472FE162B723CB /* APIHelper.swift */; }; + 22FA6CA58E58550DE36AE750 /* JSONEncodableEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9791B840B8D6EAA35343B00F /* JSONEncodableEncoding.swift */; }; + 248F2F0F29E8FDAE9CAD64C5 /* AdditionalPropertiesClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */; }; + 269E3103C458C78EA5726EE2 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8C298FC8929DCB369053F11 /* Extensions.swift */; }; + 294CDFA409BC369C0FDC5FB3 /* SpecialModelName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 386FD590658E90509C121118 /* SpecialModelName.swift */; }; + 2B441CDFFFDDB343C04F5375 /* Animal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95568E7C35F119EB4A12B498 /* Animal.swift */; }; + 2C29D5B60E00DDA3878F1BDE /* Pet.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECFEB4C6C257B3BB3CEA36D1 /* Pet.swift */; }; + 31DFF71D8CCCA0D2D2F8AC90 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5565A447062C7B8F695F451 /* User.swift */; }; + 34C26979F4678B5B579D26E8 /* FakeClassnameTags123API.swift in Sources */ = {isa = PBXBuildFile; fileRef = B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */; }; + 3691B017D3AA18404A563C67 /* ArrayOfNumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */; }; + 37DEADD6CD0496690725B8A7 /* Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AD994DFAA0DA93C188A4DBA /* Name.swift */; }; + 40E3027D2E38D8329C6AB01F /* APIs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DF825B8F3BADA2B2537D17 /* APIs.swift */; }; + 40E46046D2B16D1A672A08E3 /* AlamofireImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A201508DF2B697D65F2631 /* AlamofireImplementations.swift */; }; + 418DB36F23C53C6E2C3CDE39 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A235FA3FDFB086CC69CDE83D /* Alamofire.framework */; }; + 41A491E9B577C510F927D126 /* OuterEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */; }; + 45B3B29D7A62049F824751F8 /* AnimalFarm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D22BE01748F51106DE02332 /* AnimalFarm.swift */; }; + 4A344DF7ECE721B4BBEDCB4A /* CatAllOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */; }; + 4B4BE77747413A9188CDABD2 /* ArrayOfArrayOfNumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */; }; + 555DEA47352B42E49082922B /* NumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8E0B16084741FCB82389F58 /* NumberOnly.swift */; }; + 5695497F5DBF6C08842755A3 /* TypeHolderDefault.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */; }; + 61322FC4325F1A4FF24ACA48 /* EnumArrays.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10503995D9EFD031A2EFB576 /* EnumArrays.swift */; }; + 64C48E3658CF53EBE8AF82F9 /* UserAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8D5F382979854D47F18DB1 /* UserAPI.swift */; }; + 6B638A04B34C82B2091D6EDD /* FormatTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3156CE41C001C80379B84BDB /* FormatTest.swift */; }; + 6FBD978F4D1ED92E7071FFBB /* CodableHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A6F6BB2152ACEE1416D44A /* CodableHelper.swift */; }; + 72547ECFB451A509409311EE /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A444949BBC254798C3B3DD /* Configuration.swift */; }; + 72CE544C52BB33778D1B89B8 /* DogAllOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = A21A69C8402A60E01116ABBD /* DogAllOf.swift */; }; + 7441BBA84C31E06400338F89 /* ClassModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */; }; + 7588B7E2960253174ADCCF16 /* JSONEncodingHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35D710108A69DD8A5297F926 /* JSONEncodingHelper.swift */; }; + 86DE714469BE8BA28AFF710F /* HasOnlyReadOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */; }; + 914F4D1FCB17773C067C4E68 /* ReadOnlyFirst.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */; }; + 922BDADAB291907A7FD14314 /* OuterComposite.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4E0AD8F60A91F72C7687560 /* OuterComposite.swift */; }; + 97F7B85BF07A325EEBF92C93 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3933D3B2A3AC4577094D0C23 /* File.swift */; }; + 9CA19AA4483F6EB50270A81E /* List.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A6070F581E611FF44AFD40A /* List.swift */; }; + 9CF06ACDA32CB0C3E74E435C /* Model200Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82A2C3DC2235F0114C2B08E5 /* Model200Response.swift */; }; + 9DA1C6F8B4D6C8595F28C098 /* EnumTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD60AEA646791E0EDE885DE1 /* EnumTest.swift */; }; + A6E50CC6845FE58D8C236253 /* Return.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81447828475F76C5CF4F08A /* Return.swift */; }; + A6E5A5629495DB0ED672B06F /* PetAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A019F500E546A3292CE716A /* PetAPI.swift */; }; + A85E190556818FFA79896E92 /* ArrayTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1A0379CDFC55705AE76C998 /* ArrayTest.swift */; }; + ACF3037926301D4D6E848745 /* EnumClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */; }; + AD594BFB99E31A5E07579237 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = A913A57E72D723632E9A718F /* Client.swift */; }; + B301DB1B80F37C757550AA17 /* MixedPropertiesAndAdditionalPropertiesClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */; }; + B3E35FE2773D4A8BA15CFA88 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2896F8BFD1AA2965C8A3015 /* Tag.swift */; }; + BB1F3C6D50B8F0A8CC4F1749 /* Capitalization.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B38FA00A494D13F4C382A3 /* Capitalization.swift */; }; + CA9B9B19882EA044EAD0B359 /* AnotherFakeAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */; }; + CB68ABDBAADAF6B8D7B93A5D /* StoreAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53274D99BBDE1B79BF3521C /* StoreAPI.swift */; }; + D3BAB7C7A607392CA838C580 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8699F7966F748ED026A6FB4C /* Models.swift */; }; + D95A5F83AAA7D5C95A29AB83 /* Cat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 212AA914B7F1793A4E32C119 /* Cat.swift */; }; + DDBD4C0FBA3CD6A4DA3DF376 /* FakeAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E00950725DC44436C5E238C /* FakeAPI.swift */; }; + DDF1D589267D56D9BED3C6E5 /* FileSchemaTestClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */; }; + E8A58C6414E88AF3EAE45B69 /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F2985D01F8D60A4B1925C69 /* Category.swift */; }; + EDFC6C5121A43997014049CB /* StringBooleanMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */; }; + FECA2E8C9D0BDFEC459E8996 /* TypeHolderExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 02A6F6BB2152ACEE1416D44A /* CodableHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodableHelper.swift; sourceTree = ""; }; + 10503995D9EFD031A2EFB576 /* EnumArrays.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumArrays.swift; sourceTree = ""; }; + 164AD6EC9C4CCF634D7C4590 /* PetstoreClient.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PetstoreClient.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeHolderExample.swift; sourceTree = ""; }; + 212AA914B7F1793A4E32C119 /* Cat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cat.swift; sourceTree = ""; }; + 27B2E9EF856E89FEAA359A3A /* Order.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Order.swift; sourceTree = ""; }; + 28A444949BBC254798C3B3DD /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = ""; }; + 3156CE41C001C80379B84BDB /* FormatTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormatTest.swift; sourceTree = ""; }; + 35D710108A69DD8A5297F926 /* JSONEncodingHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONEncodingHelper.swift; sourceTree = ""; }; + 37DF825B8F3BADA2B2537D17 /* APIs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIs.swift; sourceTree = ""; }; + 386FD590658E90509C121118 /* SpecialModelName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpecialModelName.swift; sourceTree = ""; }; + 3933D3B2A3AC4577094D0C23 /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = ""; }; + 396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdditionalPropertiesClass.swift; sourceTree = ""; }; + 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CatAllOf.swift; sourceTree = ""; }; + 3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassModel.swift; sourceTree = ""; }; + 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringBooleanMap.swift; sourceTree = ""; }; + 4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumClass.swift; sourceTree = ""; }; + 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileSchemaTestClass.swift; sourceTree = ""; }; + 4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HasOnlyReadOnly.swift; sourceTree = ""; }; + 5AD994DFAA0DA93C188A4DBA /* Name.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Name.swift; sourceTree = ""; }; + 6E00950725DC44436C5E238C /* FakeAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeAPI.swift; sourceTree = ""; }; + 6F2985D01F8D60A4B1925C69 /* Category.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = ""; }; + 6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadOnlyFirst.swift; sourceTree = ""; }; + 7986861626C2B1CB49AD7000 /* MapTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapTest.swift; sourceTree = ""; }; + 7A6070F581E611FF44AFD40A /* List.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = List.swift; sourceTree = ""; }; + 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayOfArrayOfNumberOnly.swift; sourceTree = ""; }; + 7C8D5F382979854D47F18DB1 /* UserAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAPI.swift; sourceTree = ""; }; + 82A2C3DC2235F0114C2B08E5 /* Model200Response.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model200Response.swift; sourceTree = ""; }; + 84A201508DF2B697D65F2631 /* AlamofireImplementations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlamofireImplementations.swift; sourceTree = ""; }; + 8699F7966F748ED026A6FB4C /* Models.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = ""; }; + 897716962D472FE162B723CB /* APIHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIHelper.swift; sourceTree = ""; }; + 8D22BE01748F51106DE02332 /* AnimalFarm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimalFarm.swift; sourceTree = ""; }; + 95568E7C35F119EB4A12B498 /* Animal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Animal.swift; sourceTree = ""; }; + 9791B840B8D6EAA35343B00F /* JSONEncodableEncoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONEncodableEncoding.swift; sourceTree = ""; }; + 9A019F500E546A3292CE716A /* PetAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PetAPI.swift; sourceTree = ""; }; + 9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MixedPropertiesAndAdditionalPropertiesClass.swift; sourceTree = ""; }; + 9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnotherFakeAPI.swift; sourceTree = ""; }; + A21A69C8402A60E01116ABBD /* DogAllOf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DogAllOf.swift; sourceTree = ""; }; + A235FA3FDFB086CC69CDE83D /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Alamofire.framework; sourceTree = ""; }; + A53274D99BBDE1B79BF3521C /* StoreAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreAPI.swift; sourceTree = ""; }; + A7B38FA00A494D13F4C382A3 /* Capitalization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Capitalization.swift; sourceTree = ""; }; + A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiResponse.swift; sourceTree = ""; }; + A913A57E72D723632E9A718F /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; + B2896F8BFD1AA2965C8A3015 /* Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = ""; }; + B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeClassnameTags123API.swift; sourceTree = ""; }; + B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayOfNumberOnly.swift; sourceTree = ""; }; + B8C298FC8929DCB369053F11 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + B8E0B16084741FCB82389F58 /* NumberOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberOnly.swift; sourceTree = ""; }; + C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OuterEnum.swift; sourceTree = ""; }; + C6C3E1129526A353B963EFD7 /* Dog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dog.swift; sourceTree = ""; }; + C81447828475F76C5CF4F08A /* Return.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Return.swift; sourceTree = ""; }; + E5565A447062C7B8F695F451 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; + EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeHolderDefault.swift; sourceTree = ""; }; + ECFEB4C6C257B3BB3CEA36D1 /* Pet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pet.swift; sourceTree = ""; }; + F1A0379CDFC55705AE76C998 /* ArrayTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayTest.swift; sourceTree = ""; }; + F4E0AD8F60A91F72C7687560 /* OuterComposite.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OuterComposite.swift; sourceTree = ""; }; + FD60AEA646791E0EDE885DE1 /* EnumTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumTest.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D1990C2A394CCF025EF98A2F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 418DB36F23C53C6E2C3CDE39 /* Alamofire.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1E464C0937FE0D3A7A0FE29A /* Frameworks */ = { + isa = PBXGroup; + children = ( + 7861EE241895128F64DD7873 /* Carthage */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4FBDCF1330A9AB9122780DB3 /* Models */ = { + isa = PBXGroup; + children = ( + 396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */, + 95568E7C35F119EB4A12B498 /* Animal.swift */, + 8D22BE01748F51106DE02332 /* AnimalFarm.swift */, + A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */, + 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */, + B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */, + F1A0379CDFC55705AE76C998 /* ArrayTest.swift */, + A7B38FA00A494D13F4C382A3 /* Capitalization.swift */, + 212AA914B7F1793A4E32C119 /* Cat.swift */, + 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */, + 6F2985D01F8D60A4B1925C69 /* Category.swift */, + 3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */, + A913A57E72D723632E9A718F /* Client.swift */, + C6C3E1129526A353B963EFD7 /* Dog.swift */, + A21A69C8402A60E01116ABBD /* DogAllOf.swift */, + 10503995D9EFD031A2EFB576 /* EnumArrays.swift */, + 4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */, + FD60AEA646791E0EDE885DE1 /* EnumTest.swift */, + 3933D3B2A3AC4577094D0C23 /* File.swift */, + 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */, + 3156CE41C001C80379B84BDB /* FormatTest.swift */, + 4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */, + 7A6070F581E611FF44AFD40A /* List.swift */, + 7986861626C2B1CB49AD7000 /* MapTest.swift */, + 9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */, + 82A2C3DC2235F0114C2B08E5 /* Model200Response.swift */, + 5AD994DFAA0DA93C188A4DBA /* Name.swift */, + B8E0B16084741FCB82389F58 /* NumberOnly.swift */, + 27B2E9EF856E89FEAA359A3A /* Order.swift */, + F4E0AD8F60A91F72C7687560 /* OuterComposite.swift */, + C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */, + ECFEB4C6C257B3BB3CEA36D1 /* Pet.swift */, + 6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */, + C81447828475F76C5CF4F08A /* Return.swift */, + 386FD590658E90509C121118 /* SpecialModelName.swift */, + 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */, + B2896F8BFD1AA2965C8A3015 /* Tag.swift */, + EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */, + 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */, + E5565A447062C7B8F695F451 /* User.swift */, + ); + path = Models; + sourceTree = ""; + }; + 5FBA6AE5F64CD737F88B4565 = { + isa = PBXGroup; + children = ( + 9B364C01750D7AA4F983B9E7 /* PetstoreClient */, + 1E464C0937FE0D3A7A0FE29A /* Frameworks */, + 857F0DEA1890CE66D6DAD556 /* Products */, + ); + sourceTree = ""; + }; + 67BF3478113E6B4DF1C4E04F /* OpenAPIs */ = { + isa = PBXGroup; + children = ( + 84A201508DF2B697D65F2631 /* AlamofireImplementations.swift */, + 897716962D472FE162B723CB /* APIHelper.swift */, + 37DF825B8F3BADA2B2537D17 /* APIs.swift */, + 02A6F6BB2152ACEE1416D44A /* CodableHelper.swift */, + 28A444949BBC254798C3B3DD /* Configuration.swift */, + B8C298FC8929DCB369053F11 /* Extensions.swift */, + 9791B840B8D6EAA35343B00F /* JSONEncodableEncoding.swift */, + 35D710108A69DD8A5297F926 /* JSONEncodingHelper.swift */, + 8699F7966F748ED026A6FB4C /* Models.swift */, + F956D0CCAE23BCFD1C7BDD5D /* APIs */, + 4FBDCF1330A9AB9122780DB3 /* Models */, + ); + path = OpenAPIs; + sourceTree = ""; + }; + 7861EE241895128F64DD7873 /* Carthage */ = { + isa = PBXGroup; + children = ( + A012205B41CB71A62B86EECD /* iOS */, + ); + name = Carthage; + path = Carthage/Build; + sourceTree = ""; + }; + 857F0DEA1890CE66D6DAD556 /* Products */ = { + isa = PBXGroup; + children = ( + 164AD6EC9C4CCF634D7C4590 /* PetstoreClient.framework */, + ); + name = Products; + sourceTree = ""; + }; + 9B364C01750D7AA4F983B9E7 /* PetstoreClient */ = { + isa = PBXGroup; + children = ( + EF4C81BDD734856ED5023B77 /* Classes */, + ); + path = PetstoreClient; + sourceTree = ""; + }; + A012205B41CB71A62B86EECD /* iOS */ = { + isa = PBXGroup; + children = ( + A235FA3FDFB086CC69CDE83D /* Alamofire.framework */, + ); + path = iOS; + sourceTree = ""; + }; + EF4C81BDD734856ED5023B77 /* Classes */ = { + isa = PBXGroup; + children = ( + 67BF3478113E6B4DF1C4E04F /* OpenAPIs */, + ); + path = Classes; + sourceTree = ""; + }; + F956D0CCAE23BCFD1C7BDD5D /* APIs */ = { + isa = PBXGroup; + children = ( + 9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */, + 6E00950725DC44436C5E238C /* FakeAPI.swift */, + B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */, + 9A019F500E546A3292CE716A /* PetAPI.swift */, + A53274D99BBDE1B79BF3521C /* StoreAPI.swift */, + 7C8D5F382979854D47F18DB1 /* UserAPI.swift */, + ); + path = APIs; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C1282C2230015E0D204BEAED /* PetstoreClient */ = { + isa = PBXNativeTarget; + buildConfigurationList = B46EDEB1A7F0D78FE6394544 /* Build configuration list for PBXNativeTarget "PetstoreClient" */; + buildPhases = ( + E539708354CE60FE486F81ED /* Sources */, + D1990C2A394CCF025EF98A2F /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PetstoreClient; + productName = PetstoreClient; + productReference = 164AD6EC9C4CCF634D7C4590 /* PetstoreClient.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E7D276EE2369D8C455513C2E /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + }; + buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; + compatibilityVersion = "Xcode 10.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = 5FBA6AE5F64CD737F88B4565; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C1282C2230015E0D204BEAED /* PetstoreClient */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + E539708354CE60FE486F81ED /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1E6C7C7F271A802DF8099330 /* APIHelper.swift in Sources */, + 40E3027D2E38D8329C6AB01F /* APIs.swift in Sources */, + 248F2F0F29E8FDAE9CAD64C5 /* AdditionalPropertiesClass.swift in Sources */, + 40E46046D2B16D1A672A08E3 /* AlamofireImplementations.swift in Sources */, + 2B441CDFFFDDB343C04F5375 /* Animal.swift in Sources */, + 45B3B29D7A62049F824751F8 /* AnimalFarm.swift in Sources */, + CA9B9B19882EA044EAD0B359 /* AnotherFakeAPI.swift in Sources */, + 0299339D13C3571C4C57368A /* ApiResponse.swift in Sources */, + 4B4BE77747413A9188CDABD2 /* ArrayOfArrayOfNumberOnly.swift in Sources */, + 3691B017D3AA18404A563C67 /* ArrayOfNumberOnly.swift in Sources */, + A85E190556818FFA79896E92 /* ArrayTest.swift in Sources */, + BB1F3C6D50B8F0A8CC4F1749 /* Capitalization.swift in Sources */, + D95A5F83AAA7D5C95A29AB83 /* Cat.swift in Sources */, + 4A344DF7ECE721B4BBEDCB4A /* CatAllOf.swift in Sources */, + E8A58C6414E88AF3EAE45B69 /* Category.swift in Sources */, + 7441BBA84C31E06400338F89 /* ClassModel.swift in Sources */, + AD594BFB99E31A5E07579237 /* Client.swift in Sources */, + 6FBD978F4D1ED92E7071FFBB /* CodableHelper.swift in Sources */, + 72547ECFB451A509409311EE /* Configuration.swift in Sources */, + 0C1E4C682F2D0AF7D9E431EE /* Dog.swift in Sources */, + 72CE544C52BB33778D1B89B8 /* DogAllOf.swift in Sources */, + 61322FC4325F1A4FF24ACA48 /* EnumArrays.swift in Sources */, + ACF3037926301D4D6E848745 /* EnumClass.swift in Sources */, + 9DA1C6F8B4D6C8595F28C098 /* EnumTest.swift in Sources */, + 269E3103C458C78EA5726EE2 /* Extensions.swift in Sources */, + DDBD4C0FBA3CD6A4DA3DF376 /* FakeAPI.swift in Sources */, + 34C26979F4678B5B579D26E8 /* FakeClassnameTags123API.swift in Sources */, + 97F7B85BF07A325EEBF92C93 /* File.swift in Sources */, + DDF1D589267D56D9BED3C6E5 /* FileSchemaTestClass.swift in Sources */, + 6B638A04B34C82B2091D6EDD /* FormatTest.swift in Sources */, + 86DE714469BE8BA28AFF710F /* HasOnlyReadOnly.swift in Sources */, + 22FA6CA58E58550DE36AE750 /* JSONEncodableEncoding.swift in Sources */, + 7588B7E2960253174ADCCF16 /* JSONEncodingHelper.swift in Sources */, + 9CA19AA4483F6EB50270A81E /* List.swift in Sources */, + 081C0B80A989B1AAF2665121 /* MapTest.swift in Sources */, + B301DB1B80F37C757550AA17 /* MixedPropertiesAndAdditionalPropertiesClass.swift in Sources */, + 9CF06ACDA32CB0C3E74E435C /* Model200Response.swift in Sources */, + D3BAB7C7A607392CA838C580 /* Models.swift in Sources */, + 37DEADD6CD0496690725B8A7 /* Name.swift in Sources */, + 555DEA47352B42E49082922B /* NumberOnly.swift in Sources */, + 0E6932F1C55BA6880693C478 /* Order.swift in Sources */, + 922BDADAB291907A7FD14314 /* OuterComposite.swift in Sources */, + 41A491E9B577C510F927D126 /* OuterEnum.swift in Sources */, + 2C29D5B60E00DDA3878F1BDE /* Pet.swift in Sources */, + A6E5A5629495DB0ED672B06F /* PetAPI.swift in Sources */, + 914F4D1FCB17773C067C4E68 /* ReadOnlyFirst.swift in Sources */, + A6E50CC6845FE58D8C236253 /* Return.swift in Sources */, + 294CDFA409BC369C0FDC5FB3 /* SpecialModelName.swift in Sources */, + CB68ABDBAADAF6B8D7B93A5D /* StoreAPI.swift in Sources */, + EDFC6C5121A43997014049CB /* StringBooleanMap.swift in Sources */, + B3E35FE2773D4A8BA15CFA88 /* Tag.swift in Sources */, + 5695497F5DBF6C08842755A3 /* TypeHolderDefault.swift in Sources */, + FECA2E8C9D0BDFEC459E8996 /* TypeHolderExample.swift in Sources */, + 31DFF71D8CCCA0D2D2F8AC90 /* User.swift in Sources */, + 64C48E3658CF53EBE8AF82F9 /* UserAPI.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 3B2C02AFB91CB5C82766ED5C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; + A9EB0A02B94C427CBACFEC7C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + DD3EEB93949E9EBA4437E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + F81D4E5FECD46E9AA6DD2C29 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B46EDEB1A7F0D78FE6394544 /* Build configuration list for PBXNativeTarget "PetstoreClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DD3EEB93949E9EBA4437E9CD /* Debug */, + 3B2C02AFB91CB5C82766ED5C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ""; + }; + ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A9EB0A02B94C427CBACFEC7C /* Debug */, + F81D4E5FECD46E9AA6DD2C29 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = E7D276EE2369D8C455513C2E /* Project object */; +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..919434a6254 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000000..18d981003d6 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme new file mode 100644 index 00000000000..26d510552bb --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIHelper.swift new file mode 100644 index 00000000000..8641eb7ebf7 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -0,0 +1,70 @@ +// APIHelper.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct APIHelper { + internal static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { + let destination = source.reduce(into: [String: Any]()) { (result, item) in + if let value = item.value { + result[item.key] = value + } + } + + if destination.isEmpty { + return nil + } + return destination + } + + internal static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { + return source.reduce(into: [String: String]()) { (result, item) in + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") + } else if let value: Any = item.value { + result[item.key] = "\(value)" + } + } + } + + internal static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { + guard let source = source else { + return nil + } + + return source.reduce(into: [String: Any](), { (result, item) in + switch item.value { + case let x as Bool: + result[item.key] = x.description + default: + result[item.key] = item.value + } + }) + } + + internal static func mapValueToPathItem(_ source: Any) -> Any { + if let collection = source as? [Any?] { + return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") + } + return source + } + + internal static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { + let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in + if let collection = item.value as? [Any?] { + let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") + result.append(URLQueryItem(name: item.key, value: value)) + } else if let value = item.value { + result.append(URLQueryItem(name: item.key, value: "\(value)")) + } + } + + if destination.isEmpty { + return nil + } + return destination + } +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift new file mode 100644 index 00000000000..82b62e32eb9 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -0,0 +1,61 @@ +// APIs.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal class PetstoreClientAPI { + internal static var basePath = "http://petstore.swagger.io:80/v2" + internal static var credential: URLCredential? + internal static var customHeaders: [String: String] = [:] + internal static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() +} + +internal class RequestBuilder { + var credential: URLCredential? + var headers: [String: String] + internal let parameters: [String: Any]? + internal let isBody: Bool + internal let method: String + internal let URLString: String + + /// Optional block to obtain a reference to the request's progress instance when available. + internal var onProgressReady: ((Progress) -> Void)? + + required internal init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { + self.method = method + self.URLString = URLString + self.parameters = parameters + self.isBody = isBody + self.headers = headers + + addHeaders(PetstoreClientAPI.customHeaders) + } + + internal func addHeaders(_ aHeaders: [String: String]) { + for (header, value) in aHeaders { + headers[header] = value + } + } + + internal func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { } + + internal func addHeader(name: String, value: String) -> Self { + if !value.isEmpty { + headers[name] = value + } + return self + } + + internal func addCredential() -> Self { + self.credential = PetstoreClientAPI.credential + return self + } +} + +internal protocol RequestBuilderFactory { + func getNonDecodableBuilder() -> RequestBuilder.Type + func getBuilder() -> RequestBuilder.Type +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift new file mode 100644 index 00000000000..9126bafa69c --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -0,0 +1,42 @@ +// +// AnotherFakeAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal class AnotherFakeAPI { + /** + To test special tags + + - parameter body: (body) client model + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func call123testSpecialTags(body: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + call123testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + To test special tags + - PATCH /another-fake/dummy + - To test special tags and operation ID starting with number + - parameter body: (body) client model + - returns: RequestBuilder + */ + internal class func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder { + let path = "/another-fake/dummy" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift new file mode 100644 index 00000000000..c793f330e41 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -0,0 +1,575 @@ +// +// FakeAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal class FakeAPI { + /** + + - parameter body: (body) Input boolean as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func fakeOuterBooleanSerialize(body: Bool? = nil, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { + fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + - POST /fake/outer/boolean + - Test serialization of outer boolean types + - parameter body: (body) Input boolean as post body (optional) + - returns: RequestBuilder + */ + internal class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil) -> RequestBuilder { + let path = "/fake/outer/boolean" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input composite as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { + fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + - POST /fake/outer/composite + - Test serialization of object with outer number type + - parameter body: (body) Input composite as post body (optional) + - returns: RequestBuilder + */ + internal class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder { + let path = "/fake/outer/composite" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input number as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func fakeOuterNumberSerialize(body: Double? = nil, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { + fakeOuterNumberSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + - POST /fake/outer/number + - Test serialization of outer number types + - parameter body: (body) Input number as post body (optional) + - returns: RequestBuilder + */ + internal class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil) -> RequestBuilder { + let path = "/fake/outer/number" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input string as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func fakeOuterStringSerialize(body: String? = nil, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { + fakeOuterStringSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + - POST /fake/outer/string + - Test serialization of outer string types + - parameter body: (body) Input string as post body (optional) + - returns: RequestBuilder + */ + internal class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil) -> RequestBuilder { + let path = "/fake/outer/string" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func testBodyWithFileSchema(body: FileSchemaTestClass, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testBodyWithFileSchemaWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + - PUT /fake/body-with-file-schema + - For this test, the body for this request much reference a schema named `File`. + - parameter body: (body) + - returns: RequestBuilder + */ + internal class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder { + let path = "/fake/body-with-file-schema" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter query: (query) + - parameter body: (body) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func testBodyWithQueryParams(query: String, body: User, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + - PUT /fake/body-with-query-params + - parameter query: (query) + - parameter body: (body) + - returns: RequestBuilder + */ + internal class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder { + let path = "/fake/body-with-query-params" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "query": query + ]) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + To test \"client\" model + + - parameter body: (body) client model + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func testClientModel(body: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + To test \"client\" model + - PATCH /fake + - To test \"client\" model + - parameter body: (body) client model + - returns: RequestBuilder + */ + internal class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + + - parameter number: (form) None + - parameter double: (form) None + - parameter patternWithoutDelimiter: (form) None + - parameter byte: (form) None + - parameter integer: (form) None (optional) + - parameter int32: (form) None (optional) + - parameter int64: (form) None (optional) + - parameter float: (form) None (optional) + - parameter string: (form) None (optional) + - parameter binary: (form) None (optional) + - parameter date: (form) None (optional) + - parameter dateTime: (form) None (optional) + - parameter password: (form) None (optional) + - parameter callback: (form) None (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + - POST /fake + - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + - BASIC: + - type: http + - name: http_basic_test + - parameter number: (form) None + - parameter double: (form) None + - parameter patternWithoutDelimiter: (form) None + - parameter byte: (form) None + - parameter integer: (form) None (optional) + - parameter int32: (form) None (optional) + - parameter int64: (form) None (optional) + - parameter float: (form) None (optional) + - parameter string: (form) None (optional) + - parameter binary: (form) None (optional) + - parameter date: (form) None (optional) + - parameter dateTime: (form) None (optional) + - parameter password: (form) None (optional) + - parameter callback: (form) None (optional) + - returns: RequestBuilder + */ + internal class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "integer": integer?.encodeToJSON(), + "int32": int32?.encodeToJSON(), + "int64": int64?.encodeToJSON(), + "number": number, + "float": float, + "double": double, + "string": string, + "pattern_without_delimiter": patternWithoutDelimiter, + "byte": byte, + "binary": binary, + "date": date?.encodeToJSON(), + "dateTime": dateTime?.encodeToJSON(), + "password": password, + "callback": callback + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + * enum for parameter enumHeaderStringArray + */ + internal enum EnumHeaderStringArray_testEnumParameters: String { + case greaterThan = ">" + case dollar = "$" + } + + /** + * enum for parameter enumHeaderString + */ + internal enum EnumHeaderString_testEnumParameters: String { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" + } + + /** + * enum for parameter enumQueryStringArray + */ + internal enum EnumQueryStringArray_testEnumParameters: String { + case greaterThan = ">" + case dollar = "$" + } + + /** + * enum for parameter enumQueryString + */ + internal enum EnumQueryString_testEnumParameters: String { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" + } + + /** + * enum for parameter enumQueryInteger + */ + internal enum EnumQueryInteger_testEnumParameters: Int { + case _1 = 1 + case number2 = -2 + } + + /** + * enum for parameter enumQueryDouble + */ + internal enum EnumQueryDouble_testEnumParameters: Double { + case _11 = 1.1 + case number12 = -1.2 + } + + /** + * enum for parameter enumFormStringArray + */ + internal enum EnumFormStringArray_testEnumParameters: String { + case greaterThan = ">" + case dollar = "$" + } + + /** + * enum for parameter enumFormString + */ + internal enum EnumFormString_testEnumParameters: String { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" + } + + /** + To test enum parameters + + - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) + - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) + - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) + - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + To test enum parameters + - GET /fake + - To test enum parameters + - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) + - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) + - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) + - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) + - returns: RequestBuilder + */ + internal class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "enum_form_string_array": enumFormStringArray, + "enum_form_string": enumFormString?.rawValue + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "enum_query_string_array": enumQueryStringArray, + "enum_query_string": enumQueryString?.rawValue, + "enum_query_integer": enumQueryInteger?.rawValue, + "enum_query_double": enumQueryDouble?.rawValue + ]) + let nillableHeaders: [String: Any?] = [ + "enum_header_string_array": enumHeaderStringArray, + "enum_header_string": enumHeaderString?.rawValue + ] + let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) + } + + /** + Fake endpoint to test group parameters (optional) + + - parameter requiredStringGroup: (query) Required String in group parameters + - parameter requiredBooleanGroup: (header) Required Boolean in group parameters + - parameter requiredInt64Group: (query) Required Integer in group parameters + - parameter stringGroup: (query) String in group parameters (optional) + - parameter booleanGroup: (header) Boolean in group parameters (optional) + - parameter int64Group: (query) Integer in group parameters (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Fake endpoint to test group parameters (optional) + - DELETE /fake + - Fake endpoint to test group parameters (optional) + - parameter requiredStringGroup: (query) Required String in group parameters + - parameter requiredBooleanGroup: (header) Required Boolean in group parameters + - parameter requiredInt64Group: (query) Required Integer in group parameters + - parameter stringGroup: (query) String in group parameters (optional) + - parameter booleanGroup: (header) Boolean in group parameters (optional) + - parameter int64Group: (query) Integer in group parameters (optional) + - returns: RequestBuilder + */ + internal class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), + "int64_group": int64Group?.encodeToJSON() + ]) + let nillableHeaders: [String: Any?] = [ + "required_boolean_group": requiredBooleanGroup, + "boolean_group": booleanGroup + ] + let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) + } + + /** + test inline additionalProperties + + - parameter param: (body) request body + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func testInlineAdditionalProperties(param: [String: String], completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + test inline additionalProperties + - POST /fake/inline-additionalProperties + - parameter param: (body) request body + - returns: RequestBuilder + */ + internal class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder { + let path = "/fake/inline-additionalProperties" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + test json serialization of form data + + - parameter param: (form) field1 + - parameter param2: (form) field2 + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func testJsonFormData(param: String, param2: String, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + test json serialization of form data + - GET /fake/jsonFormData + - parameter param: (form) field1 + - parameter param2: (form) field2 + - returns: RequestBuilder + */ + internal class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder { + let path = "/fake/jsonFormData" + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "param": param, + "param2": param2 + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift new file mode 100644 index 00000000000..e4c221d8cb4 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -0,0 +1,45 @@ +// +// FakeClassnameTags123API.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal class FakeClassnameTags123API { + /** + To test class name in snake case + + - parameter body: (body) client model + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func testClassname(body: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + To test class name in snake case + - PATCH /fake_classname_test + - To test class name in snake case + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query + - parameter body: (body) client model + - returns: RequestBuilder + */ + internal class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder { + let path = "/fake_classname_test" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift new file mode 100644 index 00000000000..2e03efdebe7 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -0,0 +1,393 @@ +// +// PetAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal class PetAPI { + /** + Add a new pet to the store + + - parameter body: (body) Pet object that needs to be added to the store + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func addPet(body: Pet, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + addPetWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Add a new pet to the store + - POST /pet + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter body: (body) Pet object that needs to be added to the store + - returns: RequestBuilder + */ + internal class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder { + let path = "/pet" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Deletes a pet + + - parameter petId: (path) Pet id to delete + - parameter apiKey: (header) (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func deletePet(petId: Int64, apiKey: String? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Deletes a pet + - DELETE /pet/{petId} + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) Pet id to delete + - parameter apiKey: (header) (optional) + - returns: RequestBuilder + */ + internal class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder { + var path = "/pet/{petId}" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + let nillableHeaders: [String: Any?] = [ + "api_key": apiKey + ] + let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) + } + + /** + * enum for parameter status + */ + internal enum Status_findPetsByStatus: String { + case available = "available" + case pending = "pending" + case sold = "sold" + } + + /** + Finds Pets by status + + - parameter status: (query) Status values that need to be considered for filter + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func findPetsByStatus(status: [String], completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { + findPetsByStatusWithRequestBuilder(status: status).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + Finds Pets by status + - GET /pet/findByStatus + - Multiple status values can be provided with comma separated strings + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter status: (query) Status values that need to be considered for filter + - returns: RequestBuilder<[Pet]> + */ + internal class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { + let path = "/pet/findByStatus" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "status": status + ]) + + let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Finds Pets by tags + + - parameter tags: (query) Tags to filter by + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func findPetsByTags(tags: [String], completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { + findPetsByTagsWithRequestBuilder(tags: tags).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + Finds Pets by tags + - GET /pet/findByTags + - Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter tags: (query) Tags to filter by + - returns: RequestBuilder<[Pet]> + */ + internal class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { + let path = "/pet/findByTags" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "tags": tags + ]) + + let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Find pet by ID + + - parameter petId: (path) ID of pet to return + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func getPetById(petId: Int64, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { + getPetByIdWithRequestBuilder(petId: petId).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + Find pet by ID + - GET /pet/{petId} + - Returns a single pet + - API Key: + - type: apiKey api_key + - name: api_key + - parameter petId: (path) ID of pet to return + - returns: RequestBuilder + */ + internal class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder { + var path = "/pet/{petId}" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Update an existing pet + + - parameter body: (body) Pet object that needs to be added to the store + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func updatePet(body: Pet, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updatePetWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Update an existing pet + - PUT /pet + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter body: (body) Pet object that needs to be added to the store + - returns: RequestBuilder + */ + internal class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder { + let path = "/pet" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Updates a pet in the store with form data + + - parameter petId: (path) ID of pet that needs to be updated + - parameter name: (form) Updated name of the pet (optional) + - parameter status: (form) Updated status of the pet (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Updates a pet in the store with form data + - POST /pet/{petId} + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet that needs to be updated + - parameter name: (form) Updated name of the pet (optional) + - parameter status: (form) Updated status of the pet (optional) + - returns: RequestBuilder + */ + internal class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder { + var path = "/pet/{petId}" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "name": name, + "status": status + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + uploads an image + + - parameter petId: (path) ID of pet to update + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter file: (form) file to upload (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + uploads an image + - POST /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter file: (form) file to upload (optional) + - returns: RequestBuilder + */ + internal class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + var path = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "additionalMetadata": additionalMetadata, + "file": file + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + uploads an image (required) + + - parameter petId: (path) ID of pet to update + - parameter requiredFile: (form) file to upload + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + uploads an image (required) + - POST /fake/{petId}/uploadImageWithRequiredFile + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter requiredFile: (form) file to upload + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - returns: RequestBuilder + */ + internal class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + var path = "/fake/{petId}/uploadImageWithRequiredFile" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "additionalMetadata": additionalMetadata, + "requiredFile": requiredFile + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift new file mode 100644 index 00000000000..cfd546b9095 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -0,0 +1,145 @@ +// +// StoreAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal class StoreAPI { + /** + Delete purchase order by ID + + - parameter orderId: (path) ID of the order that needs to be deleted + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func deleteOrder(orderId: String, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + deleteOrderWithRequestBuilder(orderId: orderId).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Delete purchase order by ID + - DELETE /store/order/{order_id} + - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + - parameter orderId: (path) ID of the order that needs to be deleted + - returns: RequestBuilder + */ + internal class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder { + var path = "/store/order/{order_id}" + let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" + let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Returns pet inventories by status + + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func getInventory(completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { + getInventoryWithRequestBuilder().execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + Returns pet inventories by status + - GET /store/inventory + - Returns a map of status codes to quantities + - API Key: + - type: apiKey api_key + - name: api_key + - returns: RequestBuilder<[String:Int]> + */ + internal class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { + let path = "/store/inventory" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Find purchase order by ID + + - parameter orderId: (path) ID of pet that needs to be fetched + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func getOrderById(orderId: Int64, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { + getOrderByIdWithRequestBuilder(orderId: orderId).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + Find purchase order by ID + - GET /store/order/{order_id} + - For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + - parameter orderId: (path) ID of pet that needs to be fetched + - returns: RequestBuilder + */ + internal class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder { + var path = "/store/order/{order_id}" + let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" + let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Place an order for a pet + + - parameter body: (body) order placed for purchasing the pet + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func placeOrder(body: Order, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { + placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + Place an order for a pet + - POST /store/order + - parameter body: (body) order placed for purchasing the pet + - returns: RequestBuilder + */ + internal class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder { + let path = "/store/order" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift new file mode 100644 index 00000000000..76067cbd42a --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -0,0 +1,294 @@ +// +// UserAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal class UserAPI { + /** + Create user + + - parameter body: (body) Created user object + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func createUser(body: User, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUserWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Create user + - POST /user + - This can only be done by the logged in user. + - parameter body: (body) Created user object + - returns: RequestBuilder + */ + internal class func createUserWithRequestBuilder(body: User) -> RequestBuilder { + let path = "/user" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Creates list of users with given input array + + - parameter body: (body) List of user object + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func createUsersWithArrayInput(body: [User], completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUsersWithArrayInputWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Creates list of users with given input array + - POST /user/createWithArray + - parameter body: (body) List of user object + - returns: RequestBuilder + */ + internal class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder { + let path = "/user/createWithArray" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Creates list of users with given input array + + - parameter body: (body) List of user object + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func createUsersWithListInput(body: [User], completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUsersWithListInputWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Creates list of users with given input array + - POST /user/createWithList + - parameter body: (body) List of user object + - returns: RequestBuilder + */ + internal class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder { + let path = "/user/createWithList" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Delete user + + - parameter username: (path) The name that needs to be deleted + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func deleteUser(username: String, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + deleteUserWithRequestBuilder(username: username).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Delete user + - DELETE /user/{username} + - This can only be done by the logged in user. + - parameter username: (path) The name that needs to be deleted + - returns: RequestBuilder + */ + internal class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder { + var path = "/user/{username}" + let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" + let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get user by user name + + - parameter username: (path) The name that needs to be fetched. Use user1 for testing. + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func getUserByName(username: String, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { + getUserByNameWithRequestBuilder(username: username).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + Get user by user name + - GET /user/{username} + - parameter username: (path) The name that needs to be fetched. Use user1 for testing. + - returns: RequestBuilder + */ + internal class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder { + var path = "/user/{username}" + let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" + let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Logs user into the system + + - parameter username: (query) The user name for login + - parameter password: (query) The password for login in clear text + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func loginUser(username: String, password: String, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { + loginUserWithRequestBuilder(username: username, password: password).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + + /** + Logs user into the system + - GET /user/login + - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] + - parameter username: (query) The user name for login + - parameter password: (query) The password for login in clear text + - returns: RequestBuilder + */ + internal class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder { + let path = "/user/login" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "username": username, + "password": password + ]) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Logs out current logged in user session + + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func logoutUser(completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + logoutUserWithRequestBuilder().execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Logs out current logged in user session + - GET /user/logout + - returns: RequestBuilder + */ + internal class func logoutUserWithRequestBuilder() -> RequestBuilder { + let path = "/user/logout" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Updated user + + - parameter username: (path) name that need to be deleted + - parameter body: (body) Updated user object + - parameter completion: completion handler to receive the data and the error objects + */ + internal class func updateUser(username: String, body: User, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updateUserWithRequestBuilder(username: username, body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + + /** + Updated user + - PUT /user/{username} + - This can only be done by the logged in user. + - parameter username: (path) name that need to be deleted + - parameter body: (body) Updated user object + - returns: RequestBuilder + */ + internal class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder { + var path = "/user/{username}" + let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" + let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift new file mode 100644 index 00000000000..d1188c35a71 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -0,0 +1,450 @@ +// AlamofireImplementations.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation +import Alamofire + +class AlamofireRequestBuilderFactory: RequestBuilderFactory { + func getNonDecodableBuilder() -> RequestBuilder.Type { + return AlamofireRequestBuilder.self + } + + func getBuilder() -> RequestBuilder.Type { + return AlamofireDecodableRequestBuilder.self + } +} + +private struct SynchronizedDictionary { + + private var dictionary = [K: V]() + private let queue = DispatchQueue( + label: "SynchronizedDictionary", + qos: DispatchQoS.userInitiated, + attributes: [DispatchQueue.Attributes.concurrent], + autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency.inherit, + target: nil + ) + + internal subscript(key: K) -> V? { + get { + var value: V? + + queue.sync { + value = self.dictionary[key] + } + + return value + } + set { + queue.sync(flags: DispatchWorkItemFlags.barrier) { + self.dictionary[key] = newValue + } + } + } + } + +// Store manager to retain its reference +private var managerStore = SynchronizedDictionary() + +internal class AlamofireRequestBuilder: RequestBuilder { + required internal init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { + super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) + } + + /** + May be overridden by a subclass if you want to control the session + configuration. + */ + internal func createSessionManager() -> Alamofire.SessionManager { + let configuration = URLSessionConfiguration.default + configuration.httpAdditionalHeaders = buildHeaders() + return Alamofire.SessionManager(configuration: configuration) + } + + /** + May be overridden by a subclass if you want to custom request constructor. + */ + internal func createURLRequest() -> URLRequest? { + let encoding: ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding() + guard let originalRequest = try? URLRequest(url: URLString, method: HTTPMethod(rawValue: method)!, headers: buildHeaders()) else { return nil } + return try? encoding.encode(originalRequest, with: parameters) + } + + /** + May be overridden by a subclass if you want to control the Content-Type + that is given to an uploaded form part. + + Return nil to use the default behavior (inferring the Content-Type from + the file extension). Return the desired Content-Type otherwise. + */ + internal func contentTypeForFormPart(fileURL: URL) -> String? { + return nil + } + + /** + May be overridden by a subclass if you want to control the request + configuration (e.g. to override the cache policy). + */ + internal func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) -> DataRequest { + return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers) + } + + override internal func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + let managerId: String = UUID().uuidString + // Create a new manager for each request to customize its request header + let manager = createSessionManager() + managerStore[managerId] = manager + + let encoding: ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding() + + let xMethod = Alamofire.HTTPMethod(rawValue: method) + let fileKeys = parameters == nil ? [] : parameters!.filter { $1 is NSURL } + .map { $0.0 } + + if fileKeys.count > 0 { + manager.upload(multipartFormData: { mpForm in + for (k, v) in self.parameters! { + switch v { + case let fileURL as URL: + if let mimeType = self.contentTypeForFormPart(fileURL: fileURL) { + mpForm.append(fileURL, withName: k, fileName: fileURL.lastPathComponent, mimeType: mimeType) + } else { + mpForm.append(fileURL, withName: k) + } + case let string as String: + mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k) + case let number as NSNumber: + mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k) + default: + fatalError("Unprocessable value \(v) with key \(k)") + } + } + }, to: URLString, method: xMethod!, headers: nil, encodingCompletion: { encodingResult in + switch encodingResult { + case .success(let upload, _, _): + if let onProgressReady = self.onProgressReady { + onProgressReady(upload.uploadProgress) + } + self.processRequest(request: upload, managerId, completion) + case .failure(let encodingError): + completion(nil, ErrorResponse.error(415, nil, encodingError)) + } + }) + } else { + let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding, headers: headers) + if let onProgressReady = self.onProgressReady { + onProgressReady(request.progress) + } + processRequest(request: request, managerId, completion) + } + + } + + fileprivate func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + if let credential = self.credential { + request.authenticate(usingCredential: credential) + } + + let cleanupRequest = { + managerStore[managerId] = nil + } + + let validatedRequest = request.validate() + + switch T.self { + case is String.Type: + validatedRequest.responseString(completionHandler: { (stringResponse) in + cleanupRequest() + + if stringResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(stringResponse.response?.statusCode ?? 500, stringResponse.data, stringResponse.result.error!) + ) + return + } + + completion( + Response( + response: stringResponse.response!, + body: ((stringResponse.result.value ?? "") as! T) + ), + nil + ) + }) + case is URL.Type: + validatedRequest.responseData(completionHandler: { (dataResponse) in + cleanupRequest() + + do { + + guard !dataResponse.result.isFailure else { + throw DownloadException.responseFailed + } + + guard let data = dataResponse.data else { + throw DownloadException.responseDataMissing + } + + guard let request = request.request else { + throw DownloadException.requestMissing + } + + let fileManager = FileManager.default + let urlRequest = try request.asURLRequest() + let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] + let requestURL = try self.getURL(from: urlRequest) + + var requestPath = try self.getPath(from: requestURL) + + if let headerFileName = self.getFileName(fromContentDisposition: dataResponse.response?.allHeaderFields["Content-Disposition"] as? String) { + requestPath = requestPath.appending("/\(headerFileName)") + } + + let filePath = documentsDirectory.appendingPathComponent(requestPath) + let directoryPath = filePath.deletingLastPathComponent().path + + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) + try data.write(to: filePath, options: .atomic) + + completion( + Response( + response: dataResponse.response!, + body: (filePath as! T) + ), + nil + ) + + } catch let requestParserError as DownloadException { + completion(nil, ErrorResponse.error(400, dataResponse.data, requestParserError)) + } catch let error { + completion(nil, ErrorResponse.error(400, dataResponse.data, error)) + } + return + }) + case is Void.Type: + validatedRequest.responseData(completionHandler: { (voidResponse) in + cleanupRequest() + + if voidResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(voidResponse.response?.statusCode ?? 500, voidResponse.data, voidResponse.result.error!) + ) + return + } + + completion( + Response( + response: voidResponse.response!, + body: nil), + nil + ) + }) + default: + validatedRequest.responseData(completionHandler: { (dataResponse) in + cleanupRequest() + + if dataResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, dataResponse.result.error!) + ) + return + } + + completion( + Response( + response: dataResponse.response!, + body: (dataResponse.data as! T) + ), + nil + ) + }) + } + } + + internal func buildHeaders() -> [String: String] { + var httpHeaders = SessionManager.defaultHTTPHeaders + for (key, value) in self.headers { + httpHeaders[key] = value + } + return httpHeaders + } + + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { + + guard let contentDisposition = contentDisposition else { + return nil + } + + let items = contentDisposition.components(separatedBy: ";") + + var filename: String? + + for contentItem in items { + + let filenameKey = "filename=" + guard let range = contentItem.range(of: filenameKey) else { + break + } + + filename = contentItem + return filename? + .replacingCharacters(in: range, with: "") + .replacingOccurrences(of: "\"", with: "") + .trimmingCharacters(in: .whitespacesAndNewlines) + } + + return filename + + } + + fileprivate func getPath(from url: URL) throws -> String { + + guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { + throw DownloadException.requestMissingPath + } + + if path.hasPrefix("/") { + path.remove(at: path.startIndex) + } + + return path + + } + + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { + + guard let url = urlRequest.url else { + throw DownloadException.requestMissingURL + } + + return url + } + +} + +private enum DownloadException: Error { + case responseDataMissing + case responseFailed + case requestMissing + case requestMissingPath + case requestMissingURL +} + +internal enum AlamofireDecodableRequestBuilderError: Error { + case emptyDataResponse + case nilHTTPResponse + case jsonDecoding(DecodingError) + case generalError(Error) +} + +internal class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder { + + override fileprivate func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + if let credential = self.credential { + request.authenticate(usingCredential: credential) + } + + let cleanupRequest = { + managerStore[managerId] = nil + } + + let validatedRequest = request.validate() + + switch T.self { + case is String.Type: + validatedRequest.responseString(completionHandler: { (stringResponse) in + cleanupRequest() + + if stringResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(stringResponse.response?.statusCode ?? 500, stringResponse.data, stringResponse.result.error!) + ) + return + } + + completion( + Response( + response: stringResponse.response!, + body: ((stringResponse.result.value ?? "") as! T) + ), + nil + ) + }) + case is Void.Type: + validatedRequest.responseData(completionHandler: { (voidResponse) in + cleanupRequest() + + if voidResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(voidResponse.response?.statusCode ?? 500, voidResponse.data, voidResponse.result.error!) + ) + return + } + + completion( + Response( + response: voidResponse.response!, + body: nil), + nil + ) + }) + case is Data.Type: + validatedRequest.responseData(completionHandler: { (dataResponse) in + cleanupRequest() + + if dataResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, dataResponse.result.error!) + ) + return + } + + completion( + Response( + response: dataResponse.response!, + body: (dataResponse.data as! T) + ), + nil + ) + }) + default: + validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + cleanupRequest() + + guard dataResponse.result.isSuccess else { + completion(nil, ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, dataResponse.result.error!)) + return + } + + guard let data = dataResponse.data, !data.isEmpty else { + completion(nil, ErrorResponse.error(-1, nil, AlamofireDecodableRequestBuilderError.emptyDataResponse)) + return + } + + guard let httpResponse = dataResponse.response else { + completion(nil, ErrorResponse.error(-2, nil, AlamofireDecodableRequestBuilderError.nilHTTPResponse)) + return + } + + var responseObj: Response? + + let decodeResult: (decodableObj: T?, error: Error?) = CodableHelper.decode(T.self, from: data) + if decodeResult.error == nil { + responseObj = Response(response: httpResponse, body: decodeResult.decodableObj) + } + + completion(responseObj, decodeResult.error) + }) + } + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift new file mode 100644 index 00000000000..e17698e572c --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -0,0 +1,71 @@ +// +// CodableHelper.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal typealias EncodeResult = (data: Data?, error: Error?) + +internal class CodableHelper { + + internal static var dateformatter: DateFormatter? + + internal class func decode(_ type: T.Type, from data: Data) -> (decodableObj: T?, error: Error?) where T: Decodable { + var returnedDecodable: T? + var returnedError: Error? + + let decoder = JSONDecoder() + if let df = self.dateformatter { + decoder.dateDecodingStrategy = .formatted(df) + } else { + decoder.dataDecodingStrategy = .base64 + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = Configuration.dateFormat + decoder.dateDecodingStrategy = .formatted(formatter) + } + + do { + returnedDecodable = try decoder.decode(type, from: data) + } catch { + returnedError = error + } + + return (returnedDecodable, returnedError) + } + + internal class func encode(_ value: T, prettyPrint: Bool = false) -> EncodeResult where T: Encodable { + var returnedData: Data? + var returnedError: Error? + + let encoder = JSONEncoder() + if prettyPrint { + encoder.outputFormatting = .prettyPrinted + } + if let df = self.dateformatter { + encoder.dateEncodingStrategy = .formatted(df) + } else { + encoder.dataEncodingStrategy = .base64 + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = Configuration.dateFormat + encoder.dateEncodingStrategy = .formatted(formatter) + } + + do { + returnedData = try encoder.encode(value) + } catch { + returnedError = error + } + + return (returnedData, returnedError) + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Configuration.swift new file mode 100644 index 00000000000..bfcf939d4bb --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -0,0 +1,15 @@ +// Configuration.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal class Configuration { + + // This value is used to configure the date formatter that is used to serialize dates into JSON format. + // You must set it prior to encoding any dates, and it will only be read once. + internal static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift new file mode 100644 index 00000000000..84a3afa480d --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -0,0 +1,176 @@ +// Extensions.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +extension Bool: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Float: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Int: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Int32: JSONEncodable { + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } +} + +extension Int64: JSONEncodable { + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } +} + +extension Double: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension String: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +private func encodeIfPossible(_ object: T) -> Any { + if let encodableObject = object as? JSONEncodable { + return encodableObject.encodeToJSON() + } else { + return object as Any + } +} + +extension Array: JSONEncodable { + func encodeToJSON() -> Any { + return self.map(encodeIfPossible) + } +} + +extension Dictionary: JSONEncodable { + func encodeToJSON() -> Any { + var dictionary = [AnyHashable: Any]() + for (key, value) in self { + dictionary[key] = encodeIfPossible(value) + } + return dictionary as Any + } +} + +extension Data: JSONEncodable { + func encodeToJSON() -> Any { + return self.base64EncodedString(options: Data.Base64EncodingOptions()) + } +} + +private let dateFormatter: DateFormatter = { + if let formatter = CodableHelper.dateformatter { + return formatter + } else { + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = Configuration.dateFormat + return formatter + } +}() + +extension Date: JSONEncodable { + func encodeToJSON() -> Any { + return dateFormatter.string(from: self) as Any + } +} + +extension UUID: JSONEncodable { + func encodeToJSON() -> Any { + return self.uuidString + } +} + +extension String: CodingKey { + + public var stringValue: String { + return self + } + + public init?(stringValue: String) { + self.init(stringLiteral: stringValue) + } + + public var intValue: Int? { + return nil + } + + public init?(intValue: Int) { + return nil + } + +} + +extension KeyedEncodingContainerProtocol { + + internal mutating func encodeArray(_ values: [T], forKey key: Self.Key) throws where T: Encodable { + var arrayContainer = nestedUnkeyedContainer(forKey: key) + try arrayContainer.encode(contentsOf: values) + } + + internal mutating func encodeArrayIfPresent(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { + if let values = values { + try encodeArray(values, forKey: key) + } + } + + internal mutating func encodeMap(_ pairs: [Self.Key: T]) throws where T: Encodable { + for (key, value) in pairs { + try encode(value, forKey: key) + } + } + + internal mutating func encodeMapIfPresent(_ pairs: [Self.Key: T]?) throws where T: Encodable { + if let pairs = pairs { + try encodeMap(pairs) + } + } + +} + +extension KeyedDecodingContainerProtocol { + + internal func decodeArray(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { + var tmpArray = [T]() + + var nestedContainer = try nestedUnkeyedContainer(forKey: key) + while !nestedContainer.isAtEnd { + let arrayValue = try nestedContainer.decode(T.self) + tmpArray.append(arrayValue) + } + + return tmpArray + } + + internal func decodeArrayIfPresent(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? + + if contains(key) { + tmpArray = try decodeArray(T.self, forKey: key) + } + + return tmpArray + } + + internal func decodeMap(_ type: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] + + for key in allKeys { + if !excludedKeys.contains(key) { + let value = try decode(T.self, forKey: key) + map[key] = value + } + } + + return map + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift new file mode 100644 index 00000000000..bd9f3a2ed0d --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift @@ -0,0 +1,54 @@ +// +// JSONDataEncoding.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation +import Alamofire + +internal struct JSONDataEncoding: ParameterEncoding { + + // MARK: Properties + + private static let jsonDataKey = "jsonData" + + // MARK: Encoding + + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. This should have a single key/value + /// pair with "jsonData" as the key and a Data object as the value. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + internal func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { + var urlRequest = try urlRequest.asURLRequest() + + guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else { + return urlRequest + } + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = jsonData + + return urlRequest + } + + internal static func encodingParameters(jsonData: Data?) -> Parameters? { + var returnedParams: Parameters? + if let jsonData = jsonData, !jsonData.isEmpty { + var params = Parameters() + params[jsonDataKey] = jsonData + returnedParams = params + } + return returnedParams + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift new file mode 100644 index 00000000000..9330c457254 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -0,0 +1,43 @@ +// +// JSONEncodingHelper.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation +import Alamofire + +internal class JSONEncodingHelper { + + internal class func encodingParameters(forEncodableObject encodableObj: T?) -> Parameters? { + var params: Parameters? + + // Encode the Encodable object + if let encodableObj = encodableObj { + let encodeResult = CodableHelper.encode(encodableObj, prettyPrint: true) + if encodeResult.error == nil { + params = JSONDataEncoding.encodingParameters(jsonData: encodeResult.data) + } + } + + return params + } + + internal class func encodingParameters(forEncodableObject encodableObj: Any?) -> Parameters? { + var params: Parameters? + + if let encodableObj = encodableObj { + do { + let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) + params = JSONDataEncoding.encodingParameters(jsonData: data) + } catch { + print(error) + return nil + } + } + + return params + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift new file mode 100644 index 00000000000..5c253abc2c4 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -0,0 +1,36 @@ +// Models.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +protocol JSONEncodable { + func encodeToJSON() -> Any +} + +internal enum ErrorResponse: Error { + case error(Int, Data?, Error) +} + +internal class Response { + internal let statusCode: Int + internal let header: [String: String] + internal let body: T? + + internal init(statusCode: Int, header: [String: String], body: T?) { + self.statusCode = statusCode + self.header = header + self.body = body + } + + internal convenience init(response: HTTPURLResponse, body: T?) { + let rawHeader = response.allHeaderFields + var header = [String: String]() + for case let (key, value) as (String, String) in rawHeader { + header[key] = value + } + self.init(statusCode: response.statusCode, header: header, body: body) + } +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift new file mode 100644 index 00000000000..203d2c1a931 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -0,0 +1,25 @@ +// +// AdditionalPropertiesClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct AdditionalPropertiesClass: Codable { + + internal var mapString: [String: String]? + internal var mapMapString: [String: [String: String]]? + + internal init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { + self.mapString = mapString + self.mapMapString = mapMapString + } + + internal enum CodingKeys: String, CodingKey { + case mapString = "map_string" + case mapMapString = "map_map_string" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift new file mode 100644 index 00000000000..ada7f86de50 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -0,0 +1,20 @@ +// +// Animal.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct Animal: Codable { + + internal var className: String + internal var color: String? = "red" + + internal init(className: String, color: String?) { + self.className = className + self.color = color + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift new file mode 100644 index 00000000000..3ebe9e9a5de --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -0,0 +1,10 @@ +// +// AnimalFarm.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift new file mode 100644 index 00000000000..b60d8999b4b --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -0,0 +1,22 @@ +// +// ApiResponse.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct ApiResponse: Codable { + + internal var code: Int? + internal var type: String? + internal var message: String? + + internal init(code: Int?, type: String?, message: String?) { + self.code = code + self.type = type + self.message = message + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift new file mode 100644 index 00000000000..ef26025dcd8 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -0,0 +1,22 @@ +// +// ArrayOfArrayOfNumberOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct ArrayOfArrayOfNumberOnly: Codable { + + internal var arrayArrayNumber: [[Double]]? + + internal init(arrayArrayNumber: [[Double]]?) { + self.arrayArrayNumber = arrayArrayNumber + } + + internal enum CodingKeys: String, CodingKey { + case arrayArrayNumber = "ArrayArrayNumber" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift new file mode 100644 index 00000000000..1147e9394c7 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -0,0 +1,22 @@ +// +// ArrayOfNumberOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct ArrayOfNumberOnly: Codable { + + internal var arrayNumber: [Double]? + + internal init(arrayNumber: [Double]?) { + self.arrayNumber = arrayNumber + } + + internal enum CodingKeys: String, CodingKey { + case arrayNumber = "ArrayNumber" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift new file mode 100644 index 00000000000..ffbc3ebc736 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -0,0 +1,28 @@ +// +// ArrayTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct ArrayTest: Codable { + + internal var arrayOfString: [String]? + internal var arrayArrayOfInteger: [[Int64]]? + internal var arrayArrayOfModel: [[ReadOnlyFirst]]? + + internal init(arrayOfString: [String]?, arrayArrayOfInteger: [[Int64]]?, arrayArrayOfModel: [[ReadOnlyFirst]]?) { + self.arrayOfString = arrayOfString + self.arrayArrayOfInteger = arrayArrayOfInteger + self.arrayArrayOfModel = arrayArrayOfModel + } + + internal enum CodingKeys: String, CodingKey { + case arrayOfString = "array_of_string" + case arrayArrayOfInteger = "array_array_of_integer" + case arrayArrayOfModel = "array_array_of_model" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift new file mode 100644 index 00000000000..52cdbb01be7 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -0,0 +1,38 @@ +// +// Capitalization.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct Capitalization: Codable { + + internal var smallCamel: String? + internal var capitalCamel: String? + internal var smallSnake: String? + internal var capitalSnake: String? + internal var sCAETHFlowPoints: String? + /** Name of the pet */ + internal var ATT_NAME: String? + + internal init(smallCamel: String?, capitalCamel: String?, smallSnake: String?, capitalSnake: String?, sCAETHFlowPoints: String?, ATT_NAME: String?) { + self.smallCamel = smallCamel + self.capitalCamel = capitalCamel + self.smallSnake = smallSnake + self.capitalSnake = capitalSnake + self.sCAETHFlowPoints = sCAETHFlowPoints + self.ATT_NAME = ATT_NAME + } + + internal enum CodingKeys: String, CodingKey { + case smallCamel + case capitalCamel = "CapitalCamel" + case smallSnake = "small_Snake" + case capitalSnake = "Capital_Snake" + case sCAETHFlowPoints = "SCA_ETH_Flow_Points" + case ATT_NAME + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift new file mode 100644 index 00000000000..8a603dee5f1 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -0,0 +1,22 @@ +// +// Cat.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct Cat: Codable { + + internal var className: String + internal var color: String? = "red" + internal var declawed: Bool? + + internal init(className: String, color: String?, declawed: Bool?) { + self.className = className + self.color = color + self.declawed = declawed + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift new file mode 100644 index 00000000000..45b7dbb26dc --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -0,0 +1,18 @@ +// +// CatAllOf.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct CatAllOf: Codable { + + internal var declawed: Bool? + + internal init(declawed: Bool?) { + self.declawed = declawed + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift new file mode 100644 index 00000000000..849bf788dfb --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -0,0 +1,20 @@ +// +// Category.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct Category: Codable { + + internal var id: Int64? + internal var name: String = "default-name" + + internal init(id: Int64?, name: String) { + self.id = id + self.name = name + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift new file mode 100644 index 00000000000..c9cb2dc710f --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -0,0 +1,20 @@ +// +// ClassModel.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing model with \"_class\" property */ + +internal struct ClassModel: Codable { + + internal var _class: String? + + internal init(_class: String?) { + self._class = _class + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift new file mode 100644 index 00000000000..ddee836043f --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -0,0 +1,18 @@ +// +// Client.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct Client: Codable { + + internal var client: String? + + internal init(client: String?) { + self.client = client + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift new file mode 100644 index 00000000000..6b5250de4a4 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -0,0 +1,22 @@ +// +// Dog.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct Dog: Codable { + + internal var className: String + internal var color: String? = "red" + internal var breed: String? + + internal init(className: String, color: String?, breed: String?) { + self.className = className + self.color = color + self.breed = breed + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift new file mode 100644 index 00000000000..ef3ff7f1d78 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -0,0 +1,18 @@ +// +// DogAllOf.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct DogAllOf: Codable { + + internal var breed: String? + + internal init(breed: String?) { + self.breed = breed + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift new file mode 100644 index 00000000000..b84e5e2e1e2 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -0,0 +1,33 @@ +// +// EnumArrays.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct EnumArrays: Codable { + + internal enum JustSymbol: String, Codable { + case greaterThanOrEqualTo = ">=" + case dollar = "$" + } + internal enum ArrayEnum: String, Codable { + case fish = "fish" + case crab = "crab" + } + internal var justSymbol: JustSymbol? + internal var arrayEnum: [ArrayEnum]? + + internal init(justSymbol: JustSymbol?, arrayEnum: [ArrayEnum]?) { + self.justSymbol = justSymbol + self.arrayEnum = arrayEnum + } + + internal enum CodingKeys: String, CodingKey { + case justSymbol = "just_symbol" + case arrayEnum = "array_enum" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift new file mode 100644 index 00000000000..2520f9bd859 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -0,0 +1,14 @@ +// +// EnumClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal enum EnumClass: String, Codable { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift new file mode 100644 index 00000000000..eba9a8056ef --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -0,0 +1,52 @@ +// +// EnumTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct EnumTest: Codable { + + internal enum EnumString: String, Codable { + case upper = "UPPER" + case lower = "lower" + case empty = "" + } + internal enum EnumStringRequired: String, Codable { + case upper = "UPPER" + case lower = "lower" + case empty = "" + } + internal enum EnumInteger: Int, Codable { + case _1 = 1 + case number1 = -1 + } + internal enum EnumNumber: Double, Codable { + case _11 = 1.1 + case number12 = -1.2 + } + internal var enumString: EnumString? + internal var enumStringRequired: EnumStringRequired + internal var enumInteger: EnumInteger? + internal var enumNumber: EnumNumber? + internal var outerEnum: OuterEnum? + + internal init(enumString: EnumString?, enumStringRequired: EnumStringRequired, enumInteger: EnumInteger?, enumNumber: EnumNumber?, outerEnum: OuterEnum?) { + self.enumString = enumString + self.enumStringRequired = enumStringRequired + self.enumInteger = enumInteger + self.enumNumber = enumNumber + self.outerEnum = outerEnum + } + + internal enum CodingKeys: String, CodingKey { + case enumString = "enum_string" + case enumStringRequired = "enum_string_required" + case enumInteger = "enum_integer" + case enumNumber = "enum_number" + case outerEnum + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift new file mode 100644 index 00000000000..2845c6bb4db --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -0,0 +1,21 @@ +// +// File.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Must be named `File` for test. */ + +internal struct File: Codable { + + /** Test capitalization */ + internal var sourceURI: String? + + internal init(sourceURI: String?) { + self.sourceURI = sourceURI + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift new file mode 100644 index 00000000000..e478e6c4b7d --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -0,0 +1,20 @@ +// +// FileSchemaTestClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct FileSchemaTestClass: Codable { + + internal var file: File? + internal var files: [File]? + + internal init(file: File?, files: [File]?) { + self.file = file + self.files = files + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift new file mode 100644 index 00000000000..23395c93b56 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -0,0 +1,42 @@ +// +// FormatTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct FormatTest: Codable { + + internal var integer: Int? + internal var int32: Int? + internal var int64: Int64? + internal var number: Double + internal var float: Float? + internal var double: Double? + internal var string: String? + internal var byte: Data + internal var binary: URL? + internal var date: Date + internal var dateTime: Date? + internal var uuid: UUID? + internal var password: String + + internal init(integer: Int?, int32: Int?, int64: Int64?, number: Double, float: Float?, double: Double?, string: String?, byte: Data, binary: URL?, date: Date, dateTime: Date?, uuid: UUID?, password: String) { + self.integer = integer + self.int32 = int32 + self.int64 = int64 + self.number = number + self.float = float + self.double = double + self.string = string + self.byte = byte + self.binary = binary + self.date = date + self.dateTime = dateTime + self.uuid = uuid + self.password = password + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift new file mode 100644 index 00000000000..831963ba2ed --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -0,0 +1,20 @@ +// +// HasOnlyReadOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct HasOnlyReadOnly: Codable { + + internal var bar: String? + internal var foo: String? + + internal init(bar: String?, foo: String?) { + self.bar = bar + self.foo = foo + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift new file mode 100644 index 00000000000..ba9579996d1 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -0,0 +1,22 @@ +// +// List.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct List: Codable { + + internal var _123list: String? + + internal init(_123list: String?) { + self._123list = _123list + } + + internal enum CodingKeys: String, CodingKey { + case _123list = "123-list" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift new file mode 100644 index 00000000000..f59541f7675 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -0,0 +1,35 @@ +// +// MapTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct MapTest: Codable { + + internal enum MapOfEnumString: String, Codable { + case upper = "UPPER" + case lower = "lower" + } + internal var mapMapOfString: [String: [String: String]]? + internal var mapOfEnumString: [String: String]? + internal var directMap: [String: Bool]? + internal var indirectMap: StringBooleanMap? + + internal init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { + self.mapMapOfString = mapMapOfString + self.mapOfEnumString = mapOfEnumString + self.directMap = directMap + self.indirectMap = indirectMap + } + + internal enum CodingKeys: String, CodingKey { + case mapMapOfString = "map_map_of_string" + case mapOfEnumString = "map_of_enum_string" + case directMap = "direct_map" + case indirectMap = "indirect_map" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift new file mode 100644 index 00000000000..c71bb9256b0 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -0,0 +1,22 @@ +// +// MixedPropertiesAndAdditionalPropertiesClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct MixedPropertiesAndAdditionalPropertiesClass: Codable { + + internal var uuid: UUID? + internal var dateTime: Date? + internal var map: [String: Animal]? + + internal init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { + self.uuid = uuid + self.dateTime = dateTime + self.map = map + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift new file mode 100644 index 00000000000..f0765ad5f0e --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -0,0 +1,27 @@ +// +// Model200Response.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing model name starting with number */ + +internal struct Model200Response: Codable { + + internal var name: Int? + internal var _class: String? + + internal init(name: Int?, _class: String?) { + self.name = name + self._class = _class + } + + internal enum CodingKeys: String, CodingKey { + case name + case _class = "class" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift new file mode 100644 index 00000000000..f0c7ab7def0 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -0,0 +1,33 @@ +// +// Name.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing model name same as property name */ + +internal struct Name: Codable { + + internal var name: Int + internal var snakeCase: Int? + internal var property: String? + internal var _123number: Int? + + internal init(name: Int, snakeCase: Int?, property: String?, _123number: Int?) { + self.name = name + self.snakeCase = snakeCase + self.property = property + self._123number = _123number + } + + internal enum CodingKeys: String, CodingKey { + case name + case snakeCase = "snake_case" + case property + case _123number = "123Number" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift new file mode 100644 index 00000000000..7dbe99f1426 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -0,0 +1,22 @@ +// +// NumberOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct NumberOnly: Codable { + + internal var justNumber: Double? + + internal init(justNumber: Double?) { + self.justNumber = justNumber + } + + internal enum CodingKeys: String, CodingKey { + case justNumber = "JustNumber" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift new file mode 100644 index 00000000000..7f575485bf7 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -0,0 +1,34 @@ +// +// Order.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct Order: Codable { + + internal enum Status: String, Codable { + case placed = "placed" + case approved = "approved" + case delivered = "delivered" + } + internal var id: Int64? + internal var petId: Int64? + internal var quantity: Int? + internal var shipDate: Date? + /** Order Status */ + internal var status: Status? + internal var complete: Bool? = false + + internal init(id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) { + self.id = id + self.petId = petId + self.quantity = quantity + self.shipDate = shipDate + self.status = status + self.complete = complete + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift new file mode 100644 index 00000000000..04fbad30ef7 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -0,0 +1,28 @@ +// +// OuterComposite.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct OuterComposite: Codable { + + internal var myNumber: Double? + internal var myString: String? + internal var myBoolean: Bool? + + internal init(myNumber: Double?, myString: String?, myBoolean: Bool?) { + self.myNumber = myNumber + self.myString = myString + self.myBoolean = myBoolean + } + + internal enum CodingKeys: String, CodingKey { + case myNumber = "my_number" + case myString = "my_string" + case myBoolean = "my_boolean" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift new file mode 100644 index 00000000000..fd2d4b4cdda --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -0,0 +1,14 @@ +// +// OuterEnum.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal enum OuterEnum: String, Codable { + case placed = "placed" + case approved = "approved" + case delivered = "delivered" +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift new file mode 100644 index 00000000000..951f5929f92 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -0,0 +1,34 @@ +// +// Pet.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct Pet: Codable { + + internal enum Status: String, Codable { + case available = "available" + case pending = "pending" + case sold = "sold" + } + internal var id: Int64? + internal var category: Category? + internal var name: String + internal var photoUrls: [String] + internal var tags: [Tag]? + /** pet status in the store */ + internal var status: Status? + + internal init(id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) { + self.id = id + self.category = category + self.name = name + self.photoUrls = photoUrls + self.tags = tags + self.status = status + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift new file mode 100644 index 00000000000..d02c6cc5fd9 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -0,0 +1,20 @@ +// +// ReadOnlyFirst.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct ReadOnlyFirst: Codable { + + internal var bar: String? + internal var baz: String? + + internal init(bar: String?, baz: String?) { + self.bar = bar + self.baz = baz + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift new file mode 100644 index 00000000000..943da8ff453 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -0,0 +1,24 @@ +// +// Return.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing reserved words */ + +internal struct Return: Codable { + + internal var _return: Int? + + internal init(_return: Int?) { + self._return = _return + } + + internal enum CodingKeys: String, CodingKey { + case _return = "return" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift new file mode 100644 index 00000000000..b35724b1ca7 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -0,0 +1,22 @@ +// +// SpecialModelName.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct SpecialModelName: Codable { + + internal var specialPropertyName: Int64? + + internal init(specialPropertyName: Int64?) { + self.specialPropertyName = specialPropertyName + } + + internal enum CodingKeys: String, CodingKey { + case specialPropertyName = "$special[property.name]" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift new file mode 100644 index 00000000000..dc3d00e1301 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -0,0 +1,45 @@ +// +// StringBooleanMap.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct StringBooleanMap: Codable { + + internal var additionalProperties: [String: Bool] = [:] + + internal subscript(key: String) -> Bool? { + get { + if let value = additionalProperties[key] { + return value + } + return nil + } + + set { + additionalProperties[key] = newValue + } + } + + // Encodable protocol methods + + internal func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeMap(additionalProperties) + } + + // Decodable protocol methods + + internal init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + var nonAdditionalPropertyKeys = Set() + additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift new file mode 100644 index 00000000000..1e4de951fb2 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -0,0 +1,20 @@ +// +// Tag.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct Tag: Codable { + + internal var id: Int64? + internal var name: String? + + internal init(id: Int64?, name: String?) { + self.id = id + self.name = name + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift new file mode 100644 index 00000000000..0cff6b6a2f8 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -0,0 +1,34 @@ +// +// TypeHolderDefault.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct TypeHolderDefault: Codable { + + internal var stringItem: String = "what" + internal var numberItem: Double + internal var integerItem: Int + internal var boolItem: Bool = true + internal var arrayItem: [Int] + + internal init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) { + self.stringItem = stringItem + self.numberItem = numberItem + self.integerItem = integerItem + self.boolItem = boolItem + self.arrayItem = arrayItem + } + + internal enum CodingKeys: String, CodingKey { + case stringItem = "string_item" + case numberItem = "number_item" + case integerItem = "integer_item" + case boolItem = "bool_item" + case arrayItem = "array_item" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift new file mode 100644 index 00000000000..5d8f63dfe4a --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -0,0 +1,34 @@ +// +// TypeHolderExample.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct TypeHolderExample: Codable { + + internal var stringItem: String + internal var numberItem: Double + internal var integerItem: Int + internal var boolItem: Bool + internal var arrayItem: [Int] + + internal init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) { + self.stringItem = stringItem + self.numberItem = numberItem + self.integerItem = integerItem + self.boolItem = boolItem + self.arrayItem = arrayItem + } + + internal enum CodingKeys: String, CodingKey { + case stringItem = "string_item" + case numberItem = "number_item" + case integerItem = "integer_item" + case boolItem = "bool_item" + case arrayItem = "array_item" + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift new file mode 100644 index 00000000000..ada8a7f82d9 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -0,0 +1,33 @@ +// +// User.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct User: Codable { + + internal var id: Int64? + internal var username: String? + internal var firstName: String? + internal var lastName: String? + internal var email: String? + internal var password: String? + internal var phone: String? + /** User Status */ + internal var userStatus: Int? + + internal init(id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) { + self.id = id + self.username = username + self.firstName = firstName + self.lastName = lastName + self.email = email + self.password = password + self.phone = phone + self.userStatus = userStatus + } + +} diff --git a/samples/client/petstore/swift4/nonPublicApi/README.md b/samples/client/petstore/swift4/nonPublicApi/README.md new file mode 100644 index 00000000000..0711eb87054 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/README.md @@ -0,0 +1,141 @@ +# Swift4 API client for PetstoreClient + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: +- Build package: org.openapitools.codegen.languages.Swift4Codegen + +## Installation + +### Carthage + +Run `carthage update` + +### CocoaPods + +Run `pod install` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeAPI* | [**call123testSpecialTags**](docs/AnotherFakeAPI.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*FakeAPI* | [**fakeOuterBooleanSerialize**](docs/FakeAPI.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeAPI* | [**fakeOuterCompositeSerialize**](docs/FakeAPI.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeAPI* | [**fakeOuterNumberSerialize**](docs/FakeAPI.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeAPI* | [**fakeOuterStringSerialize**](docs/FakeAPI.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeAPI* | [**testBodyWithFileSchema**](docs/FakeAPI.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +*FakeAPI* | [**testBodyWithQueryParams**](docs/FakeAPI.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +*FakeAPI* | [**testClientModel**](docs/FakeAPI.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +*FakeAPI* | [**testEndpointParameters**](docs/FakeAPI.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeAPI* | [**testEnumParameters**](docs/FakeAPI.md#testenumparameters) | **GET** /fake | To test enum parameters +*FakeAPI* | [**testGroupParameters**](docs/FakeAPI.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeAPI* | [**testInlineAdditionalProperties**](docs/FakeAPI.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeAPI* | [**testJsonFormData**](docs/FakeAPI.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeClassnameTags123API* | [**testClassname**](docs/FakeClassnameTags123API.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetAPI* | [**addPet**](docs/PetAPI.md#addpet) | **POST** /pet | Add a new pet to the store +*PetAPI* | [**deletePet**](docs/PetAPI.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet +*PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetAPI* | [**uploadFileWithRequiredFile**](docs/PetAPI.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreAPI* | [**deleteOrder**](docs/StoreAPI.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreAPI* | [**getInventory**](docs/StoreAPI.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreAPI* | [**getOrderById**](docs/StoreAPI.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreAPI* | [**placeOrder**](docs/StoreAPI.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserAPI* | [**createUser**](docs/UserAPI.md#createuser) | **POST** /user | Create user +*UserAPI* | [**createUsersWithArrayInput**](docs/UserAPI.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserAPI* | [**createUsersWithListInput**](docs/UserAPI.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserAPI* | [**deleteUser**](docs/UserAPI.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserAPI* | [**getUserByName**](docs/UserAPI.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserAPI* | [**loginUser**](docs/UserAPI.md#loginuser) | **GET** /user/login | Logs user into the system +*UserAPI* | [**logoutUser**](docs/UserAPI.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserAPI* | [**updateUser**](docs/UserAPI.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [Animal](docs/Animal.md) + - [AnimalFarm](docs/AnimalFarm.md) + - [ApiResponse](docs/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [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) + - [File](docs/File.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [List](docs/List.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Return](docs/Return.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [StringBooleanMap](docs/StringBooleanMap.md) + - [Tag](docs/Tag.md) + - [TypeHolderDefault](docs/TypeHolderDefault.md) + - [TypeHolderExample](docs/TypeHolderExample.md) + - [User](docs/User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +## http_basic_test + +- **Type**: HTTP basic authentication + +## 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 + + +## Author + + + diff --git a/samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesAnyType.md similarity index 100% rename from samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesAnyType.md rename to samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesAnyType.md diff --git a/samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesArray.md b/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesArray.md similarity index 100% rename from samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesArray.md rename to samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesArray.md diff --git a/samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesBoolean.md similarity index 100% rename from samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesBoolean.md rename to samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesBoolean.md diff --git a/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesClass.md b/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..e22d28be1de --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesClass.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapString** | **[String:String]** | | [optional] +**mapMapString** | [String:[String: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/swift4/objcCompatible/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesInteger.md similarity index 100% rename from samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesInteger.md rename to samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesInteger.md diff --git a/samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesNumber.md similarity index 100% rename from samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesNumber.md rename to samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesNumber.md diff --git a/samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesObject.md b/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesObject.md similarity index 100% rename from samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesObject.md rename to samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesObject.md diff --git a/samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesString.md b/samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesString.md similarity index 100% rename from samples/client/petstore/swift4/objcCompatible/docs/AdditionalPropertiesString.md rename to samples/client/petstore/swift4/nonPublicApi/docs/AdditionalPropertiesString.md diff --git a/samples/client/petstore/swift4/nonPublicApi/docs/Animal.md b/samples/client/petstore/swift4/nonPublicApi/docs/Animal.md new file mode 100644 index 00000000000..69c601455cd --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Animal.md @@ -0,0 +1,11 @@ +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to "red"] + +[[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/swift4/nonPublicApi/docs/AnimalFarm.md b/samples/client/petstore/swift4/nonPublicApi/docs/AnimalFarm.md new file mode 100644 index 00000000000..df6bab21dae --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/AnimalFarm.md @@ -0,0 +1,9 @@ +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/swift4/nonPublicApi/docs/AnotherFakeAPI.md b/samples/client/petstore/swift4/nonPublicApi/docs/AnotherFakeAPI.md new file mode 100644 index 00000000000..387f5f5bb0c --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/AnotherFakeAPI.md @@ -0,0 +1,59 @@ +# AnotherFakeAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeAPI.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call123testSpecialTags** +```swift + internal class func call123testSpecialTags(body: Client, completion: @escaping (_ data: Client?, _ error: Error?) -> Void) +``` + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Client(client: "client_example") // Client | client model + +// To test special tags +AnotherFakeAPI.call123testSpecialTags(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### 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/swift4/nonPublicApi/docs/ApiResponse.md b/samples/client/petstore/swift4/nonPublicApi/docs/ApiResponse.md new file mode 100644 index 00000000000..c6d9768fe9b --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Int** | | [optional] +**type** | **String** | | [optional] +**message** | **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/swift4/nonPublicApi/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/swift4/nonPublicApi/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..c6fceff5e08 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [[Double]] | | [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/swift4/nonPublicApi/docs/ArrayOfNumberOnly.md b/samples/client/petstore/swift4/nonPublicApi/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..f09f8fa6f70 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **[Double]** | | [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/swift4/nonPublicApi/docs/ArrayTest.md b/samples/client/petstore/swift4/nonPublicApi/docs/ArrayTest.md new file mode 100644 index 00000000000..bf416b8330c --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/ArrayTest.md @@ -0,0 +1,12 @@ +# ArrayTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **[String]** | | [optional] +**arrayArrayOfInteger** | [[Int64]] | | [optional] +**arrayArrayOfModel** | [[ReadOnlyFirst]] | | [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/swift4/nonPublicApi/docs/Capitalization.md b/samples/client/petstore/swift4/nonPublicApi/docs/Capitalization.md new file mode 100644 index 00000000000..95374216c77 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Capitalization.md @@ -0,0 +1,15 @@ +# Capitalization + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**sCAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [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/swift4/nonPublicApi/docs/Cat.md b/samples/client/petstore/swift4/nonPublicApi/docs/Cat.md new file mode 100644 index 00000000000..fb5949b1576 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Cat.md @@ -0,0 +1,10 @@ +# Cat + +## 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/swift4/nonPublicApi/docs/CatAllOf.md b/samples/client/petstore/swift4/nonPublicApi/docs/CatAllOf.md new file mode 100644 index 00000000000..79789be61c0 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/CatAllOf.md @@ -0,0 +1,10 @@ +# 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/swift4/nonPublicApi/docs/Category.md b/samples/client/petstore/swift4/nonPublicApi/docs/Category.md new file mode 100644 index 00000000000..5ca5408c0f9 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Category.md @@ -0,0 +1,11 @@ +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**name** | **String** | | [default to "default-name"] + +[[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/swift4/nonPublicApi/docs/ClassModel.md b/samples/client/petstore/swift4/nonPublicApi/docs/ClassModel.md new file mode 100644 index 00000000000..e3912fdf0fd --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/ClassModel.md @@ -0,0 +1,10 @@ +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_class** | **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/swift4/nonPublicApi/docs/Client.md b/samples/client/petstore/swift4/nonPublicApi/docs/Client.md new file mode 100644 index 00000000000..0de1b238c36 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Client.md @@ -0,0 +1,10 @@ +# Client + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **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/swift4/nonPublicApi/docs/Dog.md b/samples/client/petstore/swift4/nonPublicApi/docs/Dog.md new file mode 100644 index 00000000000..4824786da04 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Dog.md @@ -0,0 +1,10 @@ +# Dog + +## 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/swift4/nonPublicApi/docs/DogAllOf.md b/samples/client/petstore/swift4/nonPublicApi/docs/DogAllOf.md new file mode 100644 index 00000000000..9302ef52e93 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/DogAllOf.md @@ -0,0 +1,10 @@ +# 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/swift4/nonPublicApi/docs/EnumArrays.md b/samples/client/petstore/swift4/nonPublicApi/docs/EnumArrays.md new file mode 100644 index 00000000000..b9a9807d3c8 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/EnumArrays.md @@ -0,0 +1,11 @@ +# EnumArrays + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **[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/swift4/nonPublicApi/docs/EnumClass.md b/samples/client/petstore/swift4/nonPublicApi/docs/EnumClass.md new file mode 100644 index 00000000000..67f017becd0 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/EnumClass.md @@ -0,0 +1,9 @@ +# EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/swift4/nonPublicApi/docs/EnumTest.md b/samples/client/petstore/swift4/nonPublicApi/docs/EnumTest.md new file mode 100644 index 00000000000..bc9b036dd76 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/EnumTest.md @@ -0,0 +1,14 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] +**enumStringRequired** | **String** | | +**enumInteger** | **Int** | | [optional] +**enumNumber** | **Double** | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.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/swift4/nonPublicApi/docs/FakeAPI.md b/samples/client/petstore/swift4/nonPublicApi/docs/FakeAPI.md new file mode 100644 index 00000000000..29181bd6456 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/FakeAPI.md @@ -0,0 +1,662 @@ +# FakeAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeAPI.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeAPI.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeAPI.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeAPI.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**testBodyWithFileSchema**](FakeAPI.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeAPI.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeAPI.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeAPI.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeAPI.md#testenumparameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeAPI.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeAPI.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeAPI.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data + + +# **fakeOuterBooleanSerialize** +```swift + internal class func fakeOuterBooleanSerialize(body: Bool? = nil, completion: @escaping (_ data: Bool?, _ error: Error?) -> Void) +``` + + + +Test serialization of outer boolean types + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = false // Bool | Input boolean as post body (optional) + +FakeAPI.fakeOuterBooleanSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Bool** | Input boolean as post body | [optional] + +### Return type + +**Bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **fakeOuterCompositeSerialize** +```swift + internal class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping (_ data: OuterComposite?, _ error: Error?) -> Void) +``` + + + +Test serialization of object with outer number type + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = OuterComposite(myNumber: 123, myString: "myString_example", myBoolean: false) // OuterComposite | Input composite as post body (optional) + +FakeAPI.fakeOuterCompositeSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md) | Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **fakeOuterNumberSerialize** +```swift + internal class func fakeOuterNumberSerialize(body: Double? = nil, completion: @escaping (_ data: Double?, _ error: Error?) -> Void) +``` + + + +Test serialization of outer number types + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = 987 // Double | Input number as post body (optional) + +FakeAPI.fakeOuterNumberSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Double** | Input number as post body | [optional] + +### Return type + +**Double** + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **fakeOuterStringSerialize** +```swift + internal class func fakeOuterStringSerialize(body: String? = nil, completion: @escaping (_ data: String?, _ error: Error?) -> Void) +``` + + + +Test serialization of outer string types + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = "body_example" // String | Input string as post body (optional) + +FakeAPI.fakeOuterStringSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String** | Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testBodyWithFileSchema** +```swift + internal class func testBodyWithFileSchema(body: FileSchemaTestClass, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = FileSchemaTestClass(file: File(sourceURI: "sourceURI_example"), files: [File(sourceURI: "sourceURI_example")]) // FileSchemaTestClass | + +FakeAPI.testBodyWithFileSchema(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testBodyWithQueryParams** +```swift + internal class func testBodyWithQueryParams(query: String, body: User, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + + + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let query = "query_example" // String | +let body = User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123) // User | + +FakeAPI.testBodyWithQueryParams(query: query, body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String** | | + **body** | [**User**](User.md) | | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testClientModel** +```swift + internal class func testClientModel(body: Client, completion: @escaping (_ data: Client?, _ error: Error?) -> Void) +``` + +To test \"client\" model + +To test \"client\" model + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Client(client: "client_example") // Client | client model + +// To test \"client\" model +FakeAPI.testClientModel(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### 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) + +# **testEndpointParameters** +```swift + internal class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let number = 987 // Double | None +let double = 987 // Double | None +let patternWithoutDelimiter = "patternWithoutDelimiter_example" // String | None +let byte = 987 // Data | None +let integer = 987 // Int | None (optional) +let int32 = 987 // Int | None (optional) +let int64 = 987 // Int64 | None (optional) +let float = 987 // Float | None (optional) +let string = "string_example" // String | None (optional) +let binary = URL(string: "https://example.com")! // URL | None (optional) +let date = Date() // Date | None (optional) +let dateTime = Date() // Date | None (optional) +let password = "password_example" // String | None (optional) +let callback = "callback_example" // String | None (optional) + +// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +FakeAPI.testEndpointParameters(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **Double** | None | + **double** | **Double** | None | + **patternWithoutDelimiter** | **String** | None | + **byte** | **Data** | None | + **integer** | **Int** | None | [optional] + **int32** | **Int** | None | [optional] + **int64** | **Int64** | None | [optional] + **float** | **Float** | None | [optional] + **string** | **String** | None | [optional] + **binary** | **URL** | None | [optional] + **date** | **Date** | None | [optional] + **dateTime** | **Date** | None | [optional] + **password** | **String** | None | [optional] + **callback** | **String** | None | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **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) + +# **testEnumParameters** +```swift + internal class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +To test enum parameters + +To test enum parameters + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let enumHeaderStringArray = ["enumHeaderStringArray_example"] // [String] | Header parameter enum test (string array) (optional) +let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .efg) +let enumQueryStringArray = ["enumQueryStringArray_example"] // [String] | Query parameter enum test (string array) (optional) +let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .efg) +let enumQueryInteger = 987 // Int | Query parameter enum test (double) (optional) +let enumQueryDouble = 987 // Double | Query parameter enum test (double) (optional) +let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .dollar) +let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .efg) + +// To test enum parameters +FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**[String]**](String.md) | Header parameter enum test (string array) | [optional] + **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .efg] + **enumQueryStringArray** | [**[String]**](String.md) | Query parameter enum test (string array) | [optional] + **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .efg] + **enumQueryInteger** | **Int** | Query parameter enum test (double) | [optional] + **enumQueryDouble** | **Double** | Query parameter enum test (double) | [optional] + **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .dollar] + **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .efg] + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testGroupParameters** +```swift + internal class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let requiredStringGroup = 987 // Int | Required String in group parameters +let requiredBooleanGroup = false // Bool | Required Boolean in group parameters +let requiredInt64Group = 987 // Int64 | Required Integer in group parameters +let stringGroup = 987 // Int | String in group parameters (optional) +let booleanGroup = false // Bool | Boolean in group parameters (optional) +let int64Group = 987 // Int64 | Integer in group parameters (optional) + +// Fake endpoint to test group parameters (optional) +FakeAPI.testGroupParameters(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **Int** | Required String in group parameters | + **requiredBooleanGroup** | **Bool** | Required Boolean in group parameters | + **requiredInt64Group** | **Int64** | Required Integer in group parameters | + **stringGroup** | **Int** | String in group parameters | [optional] + **booleanGroup** | **Bool** | Boolean in group parameters | [optional] + **int64Group** | **Int64** | Integer in group parameters | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testInlineAdditionalProperties** +```swift + internal class func testInlineAdditionalProperties(param: [String:String], completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +test inline additionalProperties + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let param = "TODO" // [String:String] | request body + +// test inline additionalProperties +FakeAPI.testInlineAdditionalProperties(param: param) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | [**[String:String]**](String.md) | request body | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testJsonFormData** +```swift + internal class func testJsonFormData(param: String, param2: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +test json serialization of form data + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let param = "param_example" // String | field1 +let param2 = "param2_example" // String | field2 + +// test json serialization of form data +FakeAPI.testJsonFormData(param: param, param2: param2) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String** | field1 | + **param2** | **String** | field2 | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + diff --git a/samples/client/petstore/swift4/nonPublicApi/docs/FakeClassnameTags123API.md b/samples/client/petstore/swift4/nonPublicApi/docs/FakeClassnameTags123API.md new file mode 100644 index 00000000000..4d82fa29a54 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/FakeClassnameTags123API.md @@ -0,0 +1,59 @@ +# FakeClassnameTags123API + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123API.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +```swift + internal class func testClassname(body: Client, completion: @escaping (_ data: Client?, _ error: Error?) -> Void) +``` + +To test class name in snake case + +To test class name in snake case + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Client(client: "client_example") // Client | client model + +// To test class name in snake case +FakeClassnameTags123API.testClassname(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### 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/swift4/nonPublicApi/docs/File.md b/samples/client/petstore/swift4/nonPublicApi/docs/File.md new file mode 100644 index 00000000000..3edfef17b79 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/File.md @@ -0,0 +1,10 @@ +# File + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [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/swift4/nonPublicApi/docs/FileSchemaTestClass.md b/samples/client/petstore/swift4/nonPublicApi/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..afdacc60b2c --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# FileSchemaTestClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**File**](File.md) | | [optional] +**files** | [File] | | [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/swift4/nonPublicApi/docs/FormatTest.md b/samples/client/petstore/swift4/nonPublicApi/docs/FormatTest.md new file mode 100644 index 00000000000..f74d94f6c46 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/FormatTest.md @@ -0,0 +1,22 @@ +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Int** | | [optional] +**int32** | **Int** | | [optional] +**int64** | **Int64** | | [optional] +**number** | **Double** | | +**float** | **Float** | | [optional] +**double** | **Double** | | [optional] +**string** | **String** | | [optional] +**byte** | **Data** | | +**binary** | **URL** | | [optional] +**date** | **Date** | | +**dateTime** | **Date** | | [optional] +**uuid** | **UUID** | | [optional] +**password** | **String** | | + +[[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/swift4/nonPublicApi/docs/HasOnlyReadOnly.md b/samples/client/petstore/swift4/nonPublicApi/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..57b6e3a17e6 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# HasOnlyReadOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**foo** | **String** | | [optional] [readonly] + +[[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/swift4/nonPublicApi/docs/List.md b/samples/client/petstore/swift4/nonPublicApi/docs/List.md new file mode 100644 index 00000000000..b77718302ed --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/List.md @@ -0,0 +1,10 @@ +# List + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_123list** | **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/swift4/nonPublicApi/docs/MapTest.md b/samples/client/petstore/swift4/nonPublicApi/docs/MapTest.md new file mode 100644 index 00000000000..56213c4113f --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/MapTest.md @@ -0,0 +1,13 @@ +# MapTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [String:[String:String]] | | [optional] +**mapOfEnumString** | **[String:String]** | | [optional] +**directMap** | **[String:Bool]** | | [optional] +**indirectMap** | [**StringBooleanMap**](StringBooleanMap.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/swift4/nonPublicApi/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/swift4/nonPublicApi/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..fcffb8ecdbf --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,12 @@ +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **UUID** | | [optional] +**dateTime** | **Date** | | [optional] +**map** | [String:Animal] | | [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/swift4/nonPublicApi/docs/Model200Response.md b/samples/client/petstore/swift4/nonPublicApi/docs/Model200Response.md new file mode 100644 index 00000000000..5865ea690cc --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Model200Response.md @@ -0,0 +1,11 @@ +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Int** | | [optional] +**_class** | **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/swift4/nonPublicApi/docs/Name.md b/samples/client/petstore/swift4/nonPublicApi/docs/Name.md new file mode 100644 index 00000000000..f7b180292cd --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Name.md @@ -0,0 +1,13 @@ +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Int** | | +**snakeCase** | **Int** | | [optional] [readonly] +**property** | **String** | | [optional] +**_123number** | **Int** | | [optional] [readonly] + +[[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/swift4/nonPublicApi/docs/NumberOnly.md b/samples/client/petstore/swift4/nonPublicApi/docs/NumberOnly.md new file mode 100644 index 00000000000..72bd361168b --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/NumberOnly.md @@ -0,0 +1,10 @@ +# NumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **Double** | | [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/swift4/nonPublicApi/docs/Order.md b/samples/client/petstore/swift4/nonPublicApi/docs/Order.md new file mode 100644 index 00000000000..15487f01175 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Order.md @@ -0,0 +1,15 @@ +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**petId** | **Int64** | | [optional] +**quantity** | **Int** | | [optional] +**shipDate** | **Date** | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **Bool** | | [optional] [default to false] + +[[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/swift4/nonPublicApi/docs/OuterComposite.md b/samples/client/petstore/swift4/nonPublicApi/docs/OuterComposite.md new file mode 100644 index 00000000000..d6b3583bc3f --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/OuterComposite.md @@ -0,0 +1,12 @@ +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **Double** | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **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/swift4/nonPublicApi/docs/OuterEnum.md b/samples/client/petstore/swift4/nonPublicApi/docs/OuterEnum.md new file mode 100644 index 00000000000..06d413b0168 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/OuterEnum.md @@ -0,0 +1,9 @@ +# OuterEnum + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/swift4/nonPublicApi/docs/Pet.md b/samples/client/petstore/swift4/nonPublicApi/docs/Pet.md new file mode 100644 index 00000000000..5c05f98fad4 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Pet.md @@ -0,0 +1,15 @@ +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **[String]** | | +**tags** | [Tag] | | [optional] +**status** | **String** | pet status in the store | [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/swift4/nonPublicApi/docs/PetAPI.md b/samples/client/petstore/swift4/nonPublicApi/docs/PetAPI.md new file mode 100644 index 00000000000..ddafde461eb --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/PetAPI.md @@ -0,0 +1,469 @@ +# PetAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetAPI.md#addpet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetAPI.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetAPI.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **addPet** +```swift + internal class func addPet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Add a new pet to the store + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Pet(id: 123, category: Category(id: 123, name: "name_example"), name: "name_example", photoUrls: ["photoUrls_example"], tags: [Tag(id: 123, name: "name_example")], status: "status_example") // Pet | Pet object that needs to be added to the store + +// Add a new pet to the store +PetAPI.addPet(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **deletePet** +```swift + internal class func deletePet(petId: Int64, apiKey: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Deletes a pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | Pet id to delete +let apiKey = "apiKey_example" // String | (optional) + +// Deletes a pet +PetAPI.deletePet(petId: petId, apiKey: apiKey) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | Pet id to delete | + **apiKey** | **String** | | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **findPetsByStatus** +```swift + internal class func findPetsByStatus(status: [String], completion: @escaping (_ data: [Pet]?, _ error: Error?) -> Void) +``` + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let status = ["status_example"] // [String] | Status values that need to be considered for filter + +// Finds Pets by status +PetAPI.findPetsByStatus(status: status) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**[String]**](String.md) | Status values that need to be considered for filter | + +### Return type + +[**[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **findPetsByTags** +```swift + internal class func findPetsByTags(tags: [String], completion: @escaping (_ data: [Pet]?, _ error: Error?) -> Void) +``` + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let tags = ["inner_example"] // [String] | Tags to filter by + +// Finds Pets by tags +PetAPI.findPetsByTags(tags: tags) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**[String]**](String.md) | Tags to filter by | + +### Return type + +[**[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **getPetById** +```swift + internal class func getPetById(petId: Int64, completion: @escaping (_ data: Pet?, _ error: Error?) -> Void) +``` + +Find pet by ID + +Returns a single pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to return + +// Find pet by ID +PetAPI.getPetById(petId: petId) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **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) + +# **updatePet** +```swift + internal class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Update an existing pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Pet(id: 123, category: Category(id: 123, name: "name_example"), name: "name_example", photoUrls: ["photoUrls_example"], tags: [Tag(id: 123, name: "name_example")], status: "status_example") // Pet | Pet object that needs to be added to the store + +// Update an existing pet +PetAPI.updatePet(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **updatePetWithForm** +```swift + internal class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Updates a pet in the store with form data + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet that needs to be updated +let name = "name_example" // String | Updated name of the pet (optional) +let status = "status_example" // String | Updated status of the pet (optional) + +// Updates a pet in the store with form data +PetAPI.updatePetWithForm(petId: petId, name: name, status: status) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet that needs to be updated | + **name** | **String** | Updated name of the pet | [optional] + **status** | **String** | Updated status of the pet | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **uploadFile** +```swift + internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +uploads an image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) +let file = URL(string: "https://example.com")! // URL | file to upload (optional) + +// uploads an image +PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **additionalMetadata** | **String** | Additional data to pass to server | [optional] + **file** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **uploadFileWithRequiredFile** +```swift + internal class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +uploads an image (required) + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) + +// uploads an image (required) +PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **requiredFile** | **URL** | file to upload | + **additionalMetadata** | **String** | Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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/swift4/nonPublicApi/docs/ReadOnlyFirst.md b/samples/client/petstore/swift4/nonPublicApi/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..ed537b87598 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# ReadOnlyFirst + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**baz** | **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/swift4/nonPublicApi/docs/Return.md b/samples/client/petstore/swift4/nonPublicApi/docs/Return.md new file mode 100644 index 00000000000..66d17c27c88 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Return.md @@ -0,0 +1,10 @@ +# Return + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Int** | | [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/swift4/nonPublicApi/docs/SpecialModelName.md b/samples/client/petstore/swift4/nonPublicApi/docs/SpecialModelName.md new file mode 100644 index 00000000000..3ec27a38c2a --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/SpecialModelName.md @@ -0,0 +1,10 @@ +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**specialPropertyName** | **Int64** | | [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/swift4/nonPublicApi/docs/StoreAPI.md b/samples/client/petstore/swift4/nonPublicApi/docs/StoreAPI.md new file mode 100644 index 00000000000..cec8acecb81 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/StoreAPI.md @@ -0,0 +1,206 @@ +# StoreAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreAPI.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreAPI.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreAPI.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreAPI.md#placeorder) | **POST** /store/order | Place an order for a pet + + +# **deleteOrder** +```swift + internal class func deleteOrder(orderId: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let orderId = "orderId_example" // String | ID of the order that needs to be deleted + +// Delete purchase order by ID +StoreAPI.deleteOrder(orderId: orderId) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String** | ID of the order that needs to be deleted | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **getInventory** +```swift + internal class func getInventory(completion: @escaping (_ data: [String:Int]?, _ error: Error?) -> Void) +``` + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + + +// Returns pet inventories by status +StoreAPI.getInventory() { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**[String:Int]** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **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) + +# **getOrderById** +```swift + internal class func getOrderById(orderId: Int64, completion: @escaping (_ data: Order?, _ error: Error?) -> Void) +``` + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let orderId = 987 // Int64 | ID of pet that needs to be fetched + +// Find purchase order by ID +StoreAPI.getOrderById(orderId: orderId) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Int64** | ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **placeOrder** +```swift + internal class func placeOrder(body: Order, completion: @escaping (_ data: Order?, _ error: Error?) -> Void) +``` + +Place an order for a pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Order(id: 123, petId: 123, quantity: 123, shipDate: Date(), status: "status_example", complete: false) // Order | order placed for purchasing the pet + +// Place an order for a pet +StoreAPI.placeOrder(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md) | order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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/swift4/nonPublicApi/docs/StringBooleanMap.md b/samples/client/petstore/swift4/nonPublicApi/docs/StringBooleanMap.md new file mode 100644 index 00000000000..7abf11ec68b --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/StringBooleanMap.md @@ -0,0 +1,9 @@ +# StringBooleanMap + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/swift4/nonPublicApi/docs/Tag.md b/samples/client/petstore/swift4/nonPublicApi/docs/Tag.md new file mode 100644 index 00000000000..ff4ac8aa451 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/Tag.md @@ -0,0 +1,11 @@ +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [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/swift4/nonPublicApi/docs/TypeHolderDefault.md b/samples/client/petstore/swift4/nonPublicApi/docs/TypeHolderDefault.md new file mode 100644 index 00000000000..5161394bdc3 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/TypeHolderDefault.md @@ -0,0 +1,14 @@ +# TypeHolderDefault + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | [default to "what"] +**numberItem** | **Double** | | +**integerItem** | **Int** | | +**boolItem** | **Bool** | | [default to true] +**arrayItem** | **[Int]** | | + +[[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/swift4/nonPublicApi/docs/TypeHolderExample.md b/samples/client/petstore/swift4/nonPublicApi/docs/TypeHolderExample.md new file mode 100644 index 00000000000..46d0471cd71 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/TypeHolderExample.md @@ -0,0 +1,14 @@ +# TypeHolderExample + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | +**numberItem** | **Double** | | +**integerItem** | **Int** | | +**boolItem** | **Bool** | | +**arrayItem** | **[Int]** | | + +[[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/swift4/nonPublicApi/docs/User.md b/samples/client/petstore/swift4/nonPublicApi/docs/User.md new file mode 100644 index 00000000000..5a439de0ff9 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/User.md @@ -0,0 +1,17 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **Int** | User Status | [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/swift4/nonPublicApi/docs/UserAPI.md b/samples/client/petstore/swift4/nonPublicApi/docs/UserAPI.md new file mode 100644 index 00000000000..56fba1b3c9e --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/docs/UserAPI.md @@ -0,0 +1,406 @@ +# UserAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserAPI.md#createuser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserAPI.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserAPI.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserAPI.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserAPI.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserAPI.md#loginuser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserAPI.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserAPI.md#updateuser) | **PUT** /user/{username} | Updated user + + +# **createUser** +```swift + internal class func createUser(body: User, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Create user + +This can only be done by the logged in user. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123) // User | Created user object + +// Create user +UserAPI.createUser(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md) | Created user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **createUsersWithArrayInput** +```swift + internal class func createUsersWithArrayInput(body: [User], completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Creates list of users with given input array + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = [User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123)] // [User] | List of user object + +// Creates list of users with given input array +UserAPI.createUsersWithArrayInput(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[User]**](User.md) | List of user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **createUsersWithListInput** +```swift + internal class func createUsersWithListInput(body: [User], completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Creates list of users with given input array + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = [User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123)] // [User] | List of user object + +// Creates list of users with given input array +UserAPI.createUsersWithListInput(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[User]**](User.md) | List of user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **deleteUser** +```swift + internal class func deleteUser(username: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Delete user + +This can only be done by the logged in user. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | The name that needs to be deleted + +// Delete user +UserAPI.deleteUser(username: username) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | The name that needs to be deleted | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **getUserByName** +```swift + internal class func getUserByName(username: String, completion: @escaping (_ data: User?, _ error: Error?) -> Void) +``` + +Get user by user name + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | The name that needs to be fetched. Use user1 for testing. + +// Get user by user name +UserAPI.getUserByName(username: username) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **loginUser** +```swift + internal class func loginUser(username: String, password: String, completion: @escaping (_ data: String?, _ error: Error?) -> Void) +``` + +Logs user into the system + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | The user name for login +let password = "password_example" // String | The password for login in clear text + +// Logs user into the system +UserAPI.loginUser(username: username, password: password) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | The user name for login | + **password** | **String** | The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **logoutUser** +```swift + internal class func logoutUser(completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Logs out current logged in user session + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + + +// Logs out current logged in user session +UserAPI.logoutUser() { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **updateUser** +```swift + internal class func updateUser(username: String, body: User, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Updated user + +This can only be done by the logged in user. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | name that need to be deleted +let body = User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123) // User | Updated user object + +// Updated user +UserAPI.updateUser(username: username, body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | name that need to be deleted | + **body** | [**User**](User.md) | Updated user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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/swift4/objcCompatible/docs/XmlItem.md b/samples/client/petstore/swift4/nonPublicApi/docs/XmlItem.md similarity index 100% rename from samples/client/petstore/swift4/objcCompatible/docs/XmlItem.md rename to samples/client/petstore/swift4/nonPublicApi/docs/XmlItem.md diff --git a/samples/client/petstore/swift4/nonPublicApi/git_push.sh b/samples/client/petstore/swift4/nonPublicApi/git_push.sh new file mode 100644 index 00000000000..ced3be2b0c7 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/swift4/nonPublicApi/pom.xml b/samples/client/petstore/swift4/nonPublicApi/pom.xml new file mode 100644 index 00000000000..5caba9cb463 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + io.swagger + Swift4PetstoreClientTests + pom + 1.0-SNAPSHOT + Swift4 Swagger Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + xcodebuild-test + integration-test + + exec + + + ./run_spmbuild.sh + + + + + + + diff --git a/samples/client/petstore/swift4/nonPublicApi/project.yml b/samples/client/petstore/swift4/nonPublicApi/project.yml new file mode 100644 index 00000000000..148b42517be --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/project.yml @@ -0,0 +1,15 @@ +name: PetstoreClient +targets: + PetstoreClient: + type: framework + platform: iOS + deploymentTarget: "10.0" + sources: [PetstoreClient] + info: + path: ./Info.plist + version: 1.0.0 + settings: + APPLICATION_EXTENSION_API_ONLY: true + scheme: {} + dependencies: + - carthage: Alamofire diff --git a/samples/client/petstore/swift4/nonPublicApi/run_spmbuild.sh b/samples/client/petstore/swift4/nonPublicApi/run_spmbuild.sh new file mode 100755 index 00000000000..1a9f585ad05 --- /dev/null +++ b/samples/client/petstore/swift4/nonPublicApi/run_spmbuild.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +swift build && exit ${PIPESTATUS[0]} diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift index 9e4312f685d..832282d224f 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -11,6 +11,7 @@ open class PetstoreClientAPI { public static var credential: URLCredential? public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() + public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder { diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 30b346de0e1..02e24286e3c 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class AnotherFakeAPI { /** diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d1f658b08d8..b0b394aa06e 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class FakeAPI { /** @@ -187,7 +186,7 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": query + "query": query.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -285,17 +284,17 @@ open class FakeAPI { "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), - "number": number, - "float": float, - "double": double, - "string": string, - "pattern_without_delimiter": patternWithoutDelimiter, - "byte": byte, - "binary": binary, + "number": number.encodeToJSON(), + "float": float?.encodeToJSON(), + "double": double.encodeToJSON(), + "string": string?.encodeToJSON(), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(), + "byte": byte.encodeToJSON(), + "binary": binary?.encodeToJSON(), "date": date?.encodeToJSON(), "dateTime": dateTime?.encodeToJSON(), - "password": password, - "callback": callback + "password": password?.encodeToJSON(), + "callback": callback?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -379,13 +378,13 @@ open class FakeAPI { To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - parameter completion: completion handler to receive the data and the error objects */ open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { @@ -403,21 +402,21 @@ open class FakeAPI { - GET /fake - To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: RequestBuilder */ open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray, - "enum_form_string": enumFormString?.rawValue + "enum_form_string_array": enumFormStringArray?.encodeToJSON(), + "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -425,14 +424,14 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray, - "enum_query_string": enumQueryString?.rawValue, - "enum_query_integer": enumQueryInteger?.rawValue, - "enum_query_double": enumQueryDouble?.rawValue + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "enum_header_string_array": enumHeaderStringArray, - "enum_header_string": enumHeaderString?.rawValue + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(), + "enum_header_string": enumHeaderString?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -487,8 +486,8 @@ open class FakeAPI { "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup, - "boolean_group": booleanGroup + "required_boolean_group": requiredBooleanGroup.encodeToJSON(), + "boolean_group": booleanGroup?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -559,8 +558,8 @@ open class FakeAPI { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "param": param, - "param2": param2 + "param": param.encodeToJSON(), + "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 6bfa09016f5..060d434fbf2 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class FakeClassnameTags123API { /** diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 39525475748..fe75962a72c 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class PetAPI { /** @@ -83,7 +82,7 @@ open class PetAPI { let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ - "api_key": apiKey + "api_key": apiKey?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -130,7 +129,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": status + "status": status.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -167,7 +166,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": tags + "tags": tags.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -285,8 +284,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "name": name, - "status": status + "name": name?.encodeToJSON(), + "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -331,8 +330,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "file": file + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -377,8 +376,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "requiredFile": requiredFile + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 98ff7b54742..d5f627df52a 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class StoreAPI { /** diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 24d0d35e9dd..ef4f971a91e 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class UserAPI { /** @@ -211,8 +210,8 @@ open class UserAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username, - "password": password + "username": username.encodeToJSON(), + "password": password.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index 60ce28c66a2..1d54e695608 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -156,7 +156,7 @@ open class AlamofireRequestBuilder: RequestBuilder { switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -176,7 +176,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) case is URL.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() do { @@ -226,7 +226,7 @@ open class AlamofireRequestBuilder: RequestBuilder { return }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -245,7 +245,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -358,7 +358,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -378,7 +378,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -397,7 +397,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Data.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -417,7 +417,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse: DataResponse) in cleanupRequest() guard dataResponse.result.isSuccess else { diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2fa32b9e0f3..f8faed255bf 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -5,7 +5,6 @@ // import Foundation -import Alamofire extension Bool: JSONEncodable { func encodeToJSON() -> Any { return self as Any } @@ -35,6 +34,10 @@ extension String: JSONEncodable { func encodeToJSON() -> Any { return self as Any } } +extension RawRepresentable where RawValue: JSONEncodable { + func encodeToJSON() -> Any { return self.rawValue as Any } +} + private func encodeIfPossible(_ object: T) -> Any { if let encodableObject = object as? JSONEncodable { return encodableObject.encodeToJSON() @@ -84,6 +87,12 @@ extension Date: JSONEncodable { } } +extension URL: JSONEncodable { + func encodeToJSON() -> Any { + return self + } +} + extension UUID: JSONEncodable { func encodeToJSON() -> Any { return self.uuidString diff --git a/samples/client/petstore/swift4/objcCompatible/docs/FakeAPI.md b/samples/client/petstore/swift4/objcCompatible/docs/FakeAPI.md index f90c5bbc98d..c7e27b881fd 100644 --- a/samples/client/petstore/swift4/objcCompatible/docs/FakeAPI.md +++ b/samples/client/petstore/swift4/objcCompatible/docs/FakeAPI.md @@ -453,13 +453,13 @@ To test enum parameters import PetstoreClient let enumHeaderStringArray = ["enumHeaderStringArray_example"] // [String] | Header parameter enum test (string array) (optional) -let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .-efg) +let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .efg) let enumQueryStringArray = ["enumQueryStringArray_example"] // [String] | Query parameter enum test (string array) (optional) -let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .-efg) +let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .efg) let enumQueryInteger = 987 // Int | Query parameter enum test (double) (optional) let enumQueryDouble = 987 // Double | Query parameter enum test (double) (optional) -let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .$) -let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .-efg) +let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .dollar) +let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .efg) // To test enum parameters FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString) { (response, error) in @@ -479,13 +479,13 @@ FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHea Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **enumHeaderStringArray** | [**[String]**](String.md) | Header parameter enum test (string array) | [optional] - **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .-efg] + **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .efg] **enumQueryStringArray** | [**[String]**](String.md) | Query parameter enum test (string array) | [optional] - **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .-efg] + **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .efg] **enumQueryInteger** | **Int** | Query parameter enum test (double) | [optional] **enumQueryDouble** | **Double** | Query parameter enum test (double) | [optional] - **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .$] - **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .-efg] + **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .dollar] + **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .efg] ### Return type diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index 9e4312f685d..832282d224f 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -11,6 +11,7 @@ open class PetstoreClientAPI { public static var credential: URLCredential? public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() + public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder { diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 7aa5c9c5415..5b75a4da29f 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import PromiseKit open class AnotherFakeAPI { diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d5c10dc1187..39c419674ba 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import PromiseKit open class FakeAPI { @@ -224,7 +223,7 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": query + "query": query.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -332,17 +331,17 @@ open class FakeAPI { "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), - "number": number, - "float": float, - "double": double, - "string": string, - "pattern_without_delimiter": patternWithoutDelimiter, - "byte": byte, - "binary": binary, + "number": number.encodeToJSON(), + "float": float?.encodeToJSON(), + "double": double.encodeToJSON(), + "string": string?.encodeToJSON(), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(), + "byte": byte.encodeToJSON(), + "binary": binary?.encodeToJSON(), "date": date?.encodeToJSON(), "dateTime": dateTime?.encodeToJSON(), - "password": password, - "callback": callback + "password": password?.encodeToJSON(), + "callback": callback?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -426,13 +425,13 @@ open class FakeAPI { To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: Promise */ open class func testEnumParameters( enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> Promise { @@ -452,21 +451,21 @@ open class FakeAPI { - GET /fake - To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: RequestBuilder */ open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray, - "enum_form_string": enumFormString?.rawValue + "enum_form_string_array": enumFormStringArray?.encodeToJSON(), + "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -474,14 +473,14 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray, - "enum_query_string": enumQueryString?.rawValue, - "enum_query_integer": enumQueryInteger?.rawValue, - "enum_query_double": enumQueryDouble?.rawValue + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "enum_header_string_array": enumHeaderStringArray, - "enum_header_string": enumHeaderString?.rawValue + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(), + "enum_header_string": enumHeaderString?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -538,8 +537,8 @@ open class FakeAPI { "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup, - "boolean_group": booleanGroup + "required_boolean_group": requiredBooleanGroup.encodeToJSON(), + "boolean_group": booleanGroup?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -614,8 +613,8 @@ open class FakeAPI { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "param": param, - "param2": param2 + "param": param.encodeToJSON(), + "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 309f70b47cf..574ec49021b 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import PromiseKit open class FakeClassnameTags123API { diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 29f579c9614..8d31c177eb9 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import PromiseKit open class PetAPI { @@ -88,7 +87,7 @@ open class PetAPI { let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ - "api_key": apiKey + "api_key": apiKey?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -143,7 +142,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": status + "status": status.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -188,7 +187,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": tags + "tags": tags.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -318,8 +317,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "name": name, - "status": status + "name": name?.encodeToJSON(), + "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -372,8 +371,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "file": file + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -426,8 +425,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "requiredFile": requiredFile + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 41eb3f85acb..685827cebe6 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import PromiseKit open class StoreAPI { diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 40c2b88f21d..83f4674553c 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import PromiseKit open class UserAPI { @@ -236,8 +235,8 @@ open class UserAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username, - "password": password + "username": username.encodeToJSON(), + "password": password.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index 60ce28c66a2..1d54e695608 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -156,7 +156,7 @@ open class AlamofireRequestBuilder: RequestBuilder { switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -176,7 +176,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) case is URL.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() do { @@ -226,7 +226,7 @@ open class AlamofireRequestBuilder: RequestBuilder { return }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -245,7 +245,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -358,7 +358,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -378,7 +378,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -397,7 +397,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Data.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -417,7 +417,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse: DataResponse) in cleanupRequest() guard dataResponse.result.isSuccess else { diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2365ab6057d..95ad6eec74e 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -5,7 +5,6 @@ // import Foundation -import Alamofire import PromiseKit extension Bool: JSONEncodable { @@ -36,6 +35,10 @@ extension String: JSONEncodable { func encodeToJSON() -> Any { return self as Any } } +extension RawRepresentable where RawValue: JSONEncodable { + func encodeToJSON() -> Any { return self.rawValue as Any } +} + private func encodeIfPossible(_ object: T) -> Any { if let encodableObject = object as? JSONEncodable { return encodableObject.encodeToJSON() @@ -85,6 +88,12 @@ extension Date: JSONEncodable { } } +extension URL: JSONEncodable { + func encodeToJSON() -> Any { + return self + } +} + extension UUID: JSONEncodable { func encodeToJSON() -> Any { return self.uuidString diff --git a/samples/client/petstore/swift4/promisekitLibrary/docs/FakeAPI.md b/samples/client/petstore/swift4/promisekitLibrary/docs/FakeAPI.md index 15f8e5f9f69..bf8e514f03d 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/docs/FakeAPI.md +++ b/samples/client/petstore/swift4/promisekitLibrary/docs/FakeAPI.md @@ -429,13 +429,13 @@ To test enum parameters import PetstoreClient let enumHeaderStringArray = ["enumHeaderStringArray_example"] // [String] | Header parameter enum test (string array) (optional) -let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .-efg) +let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .efg) let enumQueryStringArray = ["enumQueryStringArray_example"] // [String] | Query parameter enum test (string array) (optional) -let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .-efg) +let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .efg) let enumQueryInteger = 987 // Int | Query parameter enum test (double) (optional) let enumQueryDouble = 987 // Double | Query parameter enum test (double) (optional) -let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .$) -let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .-efg) +let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .dollar) +let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .efg) // To test enum parameters FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).then { @@ -452,13 +452,13 @@ FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHea Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **enumHeaderStringArray** | [**[String]**](String.md) | Header parameter enum test (string array) | [optional] - **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .-efg] + **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .efg] **enumQueryStringArray** | [**[String]**](String.md) | Query parameter enum test (string array) | [optional] - **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .-efg] + **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .efg] **enumQueryInteger** | **Int** | Query parameter enum test (double) | [optional] **enumQueryDouble** | **Double** | Query parameter enum test (double) | [optional] - **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .$] - **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .-efg] + **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .dollar] + **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .efg] ### Return type diff --git a/samples/client/petstore/swift4/resultLibrary/.gitignore b/samples/client/petstore/swift4/resultLibrary/.gitignore new file mode 100644 index 00000000000..5e5d5cebcf4 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/.gitignore @@ -0,0 +1,63 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata + +## Other +*.xccheckout +*.moved-aside +*.xcuserstate +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md + +fastlane/report.xml +fastlane/screenshots diff --git a/samples/client/petstore/swift4/resultLibrary/.openapi-generator-ignore b/samples/client/petstore/swift4/resultLibrary/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/.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/client/petstore/swift4/resultLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift4/resultLibrary/.openapi-generator/VERSION new file mode 100644 index 00000000000..e4955748d3e --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.2.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/resultLibrary/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift4/resultLibrary/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..919434a6254 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/samples/client/petstore/swift4/resultLibrary/Cartfile b/samples/client/petstore/swift4/resultLibrary/Cartfile new file mode 100644 index 00000000000..86748c63d90 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/Cartfile @@ -0,0 +1 @@ +github "Alamofire/Alamofire" ~> 4.9.0 diff --git a/samples/client/petstore/swift4/resultLibrary/Info.plist b/samples/client/petstore/swift4/resultLibrary/Info.plist new file mode 100644 index 00000000000..323e5ecfc42 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/samples/client/petstore/swift4/resultLibrary/Package.resolved b/samples/client/petstore/swift4/resultLibrary/Package.resolved new file mode 100644 index 00000000000..ca6137050eb --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "Alamofire", + "repositoryURL": "https://github.com/Alamofire/Alamofire.git", + "state": { + "branch": null, + "revision": "747c8db8d57b68d5e35275f10c92d55f982adbd4", + "version": "4.9.1" + } + } + ] + }, + "version": 1 +} diff --git a/samples/client/petstore/swift4/resultLibrary/Package.swift b/samples/client/petstore/swift4/resultLibrary/Package.swift new file mode 100644 index 00000000000..e5c5f0f33b8 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/Package.swift @@ -0,0 +1,27 @@ +// swift-tools-version:4.2 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "PetstoreClient", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "PetstoreClient", + targets: ["PetstoreClient"]) + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9.0") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "PetstoreClient", + dependencies: ["Alamofire"], + path: "PetstoreClient/Classes" + ) + ] +) diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient.podspec b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.podspec new file mode 100644 index 00000000000..a6c9a1f3d45 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.podspec @@ -0,0 +1,14 @@ +Pod::Spec.new do |s| + s.name = 'PetstoreClient' + s.ios.deployment_target = '9.0' + s.osx.deployment_target = '10.11' + s.tvos.deployment_target = '9.0' + s.version = '1.0.0' + s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } + s.authors = '' + s.license = 'Proprietary' + s.homepage = 'https://github.com/openapitools/openapi-generator' + s.summary = 'PetstoreClient' + s.source_files = 'PetstoreClient/Classes/**/*.swift' + s.dependency 'Alamofire', '~> 4.9.0' +end diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..49e6ca81fd8 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -0,0 +1,580 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 0299339D13C3571C4C57368A /* ApiResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */; }; + 081C0B80A989B1AAF2665121 /* MapTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7986861626C2B1CB49AD7000 /* MapTest.swift */; }; + 0C1E4C682F2D0AF7D9E431EE /* Dog.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6C3E1129526A353B963EFD7 /* Dog.swift */; }; + 0E6932F1C55BA6880693C478 /* Order.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B2E9EF856E89FEAA359A3A /* Order.swift */; }; + 1E6C7C7F271A802DF8099330 /* APIHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 897716962D472FE162B723CB /* APIHelper.swift */; }; + 22FA6CA58E58550DE36AE750 /* JSONEncodableEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9791B840B8D6EAA35343B00F /* JSONEncodableEncoding.swift */; }; + 248F2F0F29E8FDAE9CAD64C5 /* AdditionalPropertiesClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */; }; + 269E3103C458C78EA5726EE2 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8C298FC8929DCB369053F11 /* Extensions.swift */; }; + 294CDFA409BC369C0FDC5FB3 /* SpecialModelName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 386FD590658E90509C121118 /* SpecialModelName.swift */; }; + 2B441CDFFFDDB343C04F5375 /* Animal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95568E7C35F119EB4A12B498 /* Animal.swift */; }; + 2C29D5B60E00DDA3878F1BDE /* Pet.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECFEB4C6C257B3BB3CEA36D1 /* Pet.swift */; }; + 31DFF71D8CCCA0D2D2F8AC90 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5565A447062C7B8F695F451 /* User.swift */; }; + 34C26979F4678B5B579D26E8 /* FakeClassnameTags123API.swift in Sources */ = {isa = PBXBuildFile; fileRef = B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */; }; + 3691B017D3AA18404A563C67 /* ArrayOfNumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */; }; + 37DEADD6CD0496690725B8A7 /* Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AD994DFAA0DA93C188A4DBA /* Name.swift */; }; + 40E3027D2E38D8329C6AB01F /* APIs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DF825B8F3BADA2B2537D17 /* APIs.swift */; }; + 40E46046D2B16D1A672A08E3 /* AlamofireImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A201508DF2B697D65F2631 /* AlamofireImplementations.swift */; }; + 418DB36F23C53C6E2C3CDE39 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A235FA3FDFB086CC69CDE83D /* Alamofire.framework */; }; + 41A491E9B577C510F927D126 /* OuterEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */; }; + 45B3B29D7A62049F824751F8 /* AnimalFarm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D22BE01748F51106DE02332 /* AnimalFarm.swift */; }; + 4A344DF7ECE721B4BBEDCB4A /* CatAllOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */; }; + 4B4BE77747413A9188CDABD2 /* ArrayOfArrayOfNumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */; }; + 555DEA47352B42E49082922B /* NumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8E0B16084741FCB82389F58 /* NumberOnly.swift */; }; + 5695497F5DBF6C08842755A3 /* TypeHolderDefault.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */; }; + 61322FC4325F1A4FF24ACA48 /* EnumArrays.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10503995D9EFD031A2EFB576 /* EnumArrays.swift */; }; + 64C48E3658CF53EBE8AF82F9 /* UserAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8D5F382979854D47F18DB1 /* UserAPI.swift */; }; + 6B638A04B34C82B2091D6EDD /* FormatTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3156CE41C001C80379B84BDB /* FormatTest.swift */; }; + 6FBD978F4D1ED92E7071FFBB /* CodableHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A6F6BB2152ACEE1416D44A /* CodableHelper.swift */; }; + 72547ECFB451A509409311EE /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A444949BBC254798C3B3DD /* Configuration.swift */; }; + 72CE544C52BB33778D1B89B8 /* DogAllOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = A21A69C8402A60E01116ABBD /* DogAllOf.swift */; }; + 7441BBA84C31E06400338F89 /* ClassModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */; }; + 7588B7E2960253174ADCCF16 /* JSONEncodingHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35D710108A69DD8A5297F926 /* JSONEncodingHelper.swift */; }; + 86DE714469BE8BA28AFF710F /* HasOnlyReadOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */; }; + 913B0BA470D8357FF8A2FFD3 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 099A5E845AF5E1409204325B /* Result.swift */; }; + 914F4D1FCB17773C067C4E68 /* ReadOnlyFirst.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */; }; + 922BDADAB291907A7FD14314 /* OuterComposite.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4E0AD8F60A91F72C7687560 /* OuterComposite.swift */; }; + 97F7B85BF07A325EEBF92C93 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3933D3B2A3AC4577094D0C23 /* File.swift */; }; + 9CA19AA4483F6EB50270A81E /* List.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A6070F581E611FF44AFD40A /* List.swift */; }; + 9CF06ACDA32CB0C3E74E435C /* Model200Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82A2C3DC2235F0114C2B08E5 /* Model200Response.swift */; }; + 9DA1C6F8B4D6C8595F28C098 /* EnumTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD60AEA646791E0EDE885DE1 /* EnumTest.swift */; }; + A6E50CC6845FE58D8C236253 /* Return.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81447828475F76C5CF4F08A /* Return.swift */; }; + A6E5A5629495DB0ED672B06F /* PetAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A019F500E546A3292CE716A /* PetAPI.swift */; }; + A85E190556818FFA79896E92 /* ArrayTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1A0379CDFC55705AE76C998 /* ArrayTest.swift */; }; + ACF3037926301D4D6E848745 /* EnumClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */; }; + AD594BFB99E31A5E07579237 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = A913A57E72D723632E9A718F /* Client.swift */; }; + B301DB1B80F37C757550AA17 /* MixedPropertiesAndAdditionalPropertiesClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */; }; + B3E35FE2773D4A8BA15CFA88 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2896F8BFD1AA2965C8A3015 /* Tag.swift */; }; + BB1F3C6D50B8F0A8CC4F1749 /* Capitalization.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B38FA00A494D13F4C382A3 /* Capitalization.swift */; }; + CA9B9B19882EA044EAD0B359 /* AnotherFakeAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */; }; + CB68ABDBAADAF6B8D7B93A5D /* StoreAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53274D99BBDE1B79BF3521C /* StoreAPI.swift */; }; + D3BAB7C7A607392CA838C580 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8699F7966F748ED026A6FB4C /* Models.swift */; }; + D95A5F83AAA7D5C95A29AB83 /* Cat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 212AA914B7F1793A4E32C119 /* Cat.swift */; }; + DDBD4C0FBA3CD6A4DA3DF376 /* FakeAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E00950725DC44436C5E238C /* FakeAPI.swift */; }; + DDF1D589267D56D9BED3C6E5 /* FileSchemaTestClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */; }; + E8A58C6414E88AF3EAE45B69 /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F2985D01F8D60A4B1925C69 /* Category.swift */; }; + EDFC6C5121A43997014049CB /* StringBooleanMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */; }; + FECA2E8C9D0BDFEC459E8996 /* TypeHolderExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 02A6F6BB2152ACEE1416D44A /* CodableHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodableHelper.swift; sourceTree = ""; }; + 099A5E845AF5E1409204325B /* Result.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; }; + 10503995D9EFD031A2EFB576 /* EnumArrays.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumArrays.swift; sourceTree = ""; }; + 164AD6EC9C4CCF634D7C4590 /* PetstoreClient.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PetstoreClient.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeHolderExample.swift; sourceTree = ""; }; + 212AA914B7F1793A4E32C119 /* Cat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cat.swift; sourceTree = ""; }; + 27B2E9EF856E89FEAA359A3A /* Order.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Order.swift; sourceTree = ""; }; + 28A444949BBC254798C3B3DD /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = ""; }; + 3156CE41C001C80379B84BDB /* FormatTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormatTest.swift; sourceTree = ""; }; + 35D710108A69DD8A5297F926 /* JSONEncodingHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONEncodingHelper.swift; sourceTree = ""; }; + 37DF825B8F3BADA2B2537D17 /* APIs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIs.swift; sourceTree = ""; }; + 386FD590658E90509C121118 /* SpecialModelName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpecialModelName.swift; sourceTree = ""; }; + 3933D3B2A3AC4577094D0C23 /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = ""; }; + 396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdditionalPropertiesClass.swift; sourceTree = ""; }; + 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CatAllOf.swift; sourceTree = ""; }; + 3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassModel.swift; sourceTree = ""; }; + 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringBooleanMap.swift; sourceTree = ""; }; + 4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumClass.swift; sourceTree = ""; }; + 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileSchemaTestClass.swift; sourceTree = ""; }; + 4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HasOnlyReadOnly.swift; sourceTree = ""; }; + 5AD994DFAA0DA93C188A4DBA /* Name.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Name.swift; sourceTree = ""; }; + 6E00950725DC44436C5E238C /* FakeAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeAPI.swift; sourceTree = ""; }; + 6F2985D01F8D60A4B1925C69 /* Category.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = ""; }; + 6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadOnlyFirst.swift; sourceTree = ""; }; + 7986861626C2B1CB49AD7000 /* MapTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapTest.swift; sourceTree = ""; }; + 7A6070F581E611FF44AFD40A /* List.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = List.swift; sourceTree = ""; }; + 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayOfArrayOfNumberOnly.swift; sourceTree = ""; }; + 7C8D5F382979854D47F18DB1 /* UserAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAPI.swift; sourceTree = ""; }; + 82A2C3DC2235F0114C2B08E5 /* Model200Response.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model200Response.swift; sourceTree = ""; }; + 84A201508DF2B697D65F2631 /* AlamofireImplementations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlamofireImplementations.swift; sourceTree = ""; }; + 8699F7966F748ED026A6FB4C /* Models.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = ""; }; + 897716962D472FE162B723CB /* APIHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIHelper.swift; sourceTree = ""; }; + 8D22BE01748F51106DE02332 /* AnimalFarm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimalFarm.swift; sourceTree = ""; }; + 95568E7C35F119EB4A12B498 /* Animal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Animal.swift; sourceTree = ""; }; + 9791B840B8D6EAA35343B00F /* JSONEncodableEncoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONEncodableEncoding.swift; sourceTree = ""; }; + 9A019F500E546A3292CE716A /* PetAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PetAPI.swift; sourceTree = ""; }; + 9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MixedPropertiesAndAdditionalPropertiesClass.swift; sourceTree = ""; }; + 9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnotherFakeAPI.swift; sourceTree = ""; }; + A21A69C8402A60E01116ABBD /* DogAllOf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DogAllOf.swift; sourceTree = ""; }; + A235FA3FDFB086CC69CDE83D /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Alamofire.framework; sourceTree = ""; }; + A53274D99BBDE1B79BF3521C /* StoreAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreAPI.swift; sourceTree = ""; }; + A7B38FA00A494D13F4C382A3 /* Capitalization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Capitalization.swift; sourceTree = ""; }; + A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiResponse.swift; sourceTree = ""; }; + A913A57E72D723632E9A718F /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; + B2896F8BFD1AA2965C8A3015 /* Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = ""; }; + B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeClassnameTags123API.swift; sourceTree = ""; }; + B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayOfNumberOnly.swift; sourceTree = ""; }; + B8C298FC8929DCB369053F11 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + B8E0B16084741FCB82389F58 /* NumberOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberOnly.swift; sourceTree = ""; }; + C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OuterEnum.swift; sourceTree = ""; }; + C6C3E1129526A353B963EFD7 /* Dog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dog.swift; sourceTree = ""; }; + C81447828475F76C5CF4F08A /* Return.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Return.swift; sourceTree = ""; }; + E5565A447062C7B8F695F451 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; + EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeHolderDefault.swift; sourceTree = ""; }; + ECFEB4C6C257B3BB3CEA36D1 /* Pet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pet.swift; sourceTree = ""; }; + F1A0379CDFC55705AE76C998 /* ArrayTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayTest.swift; sourceTree = ""; }; + F4E0AD8F60A91F72C7687560 /* OuterComposite.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OuterComposite.swift; sourceTree = ""; }; + FD60AEA646791E0EDE885DE1 /* EnumTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumTest.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D1990C2A394CCF025EF98A2F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 418DB36F23C53C6E2C3CDE39 /* Alamofire.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1E464C0937FE0D3A7A0FE29A /* Frameworks */ = { + isa = PBXGroup; + children = ( + 7861EE241895128F64DD7873 /* Carthage */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4FBDCF1330A9AB9122780DB3 /* Models */ = { + isa = PBXGroup; + children = ( + 396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */, + 95568E7C35F119EB4A12B498 /* Animal.swift */, + 8D22BE01748F51106DE02332 /* AnimalFarm.swift */, + A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */, + 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */, + B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */, + F1A0379CDFC55705AE76C998 /* ArrayTest.swift */, + A7B38FA00A494D13F4C382A3 /* Capitalization.swift */, + 212AA914B7F1793A4E32C119 /* Cat.swift */, + 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */, + 6F2985D01F8D60A4B1925C69 /* Category.swift */, + 3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */, + A913A57E72D723632E9A718F /* Client.swift */, + C6C3E1129526A353B963EFD7 /* Dog.swift */, + A21A69C8402A60E01116ABBD /* DogAllOf.swift */, + 10503995D9EFD031A2EFB576 /* EnumArrays.swift */, + 4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */, + FD60AEA646791E0EDE885DE1 /* EnumTest.swift */, + 3933D3B2A3AC4577094D0C23 /* File.swift */, + 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */, + 3156CE41C001C80379B84BDB /* FormatTest.swift */, + 4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */, + 7A6070F581E611FF44AFD40A /* List.swift */, + 7986861626C2B1CB49AD7000 /* MapTest.swift */, + 9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */, + 82A2C3DC2235F0114C2B08E5 /* Model200Response.swift */, + 5AD994DFAA0DA93C188A4DBA /* Name.swift */, + B8E0B16084741FCB82389F58 /* NumberOnly.swift */, + 27B2E9EF856E89FEAA359A3A /* Order.swift */, + F4E0AD8F60A91F72C7687560 /* OuterComposite.swift */, + C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */, + ECFEB4C6C257B3BB3CEA36D1 /* Pet.swift */, + 6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */, + C81447828475F76C5CF4F08A /* Return.swift */, + 386FD590658E90509C121118 /* SpecialModelName.swift */, + 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */, + B2896F8BFD1AA2965C8A3015 /* Tag.swift */, + EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */, + 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */, + E5565A447062C7B8F695F451 /* User.swift */, + ); + path = Models; + sourceTree = ""; + }; + 5FBA6AE5F64CD737F88B4565 = { + isa = PBXGroup; + children = ( + 9B364C01750D7AA4F983B9E7 /* PetstoreClient */, + 1E464C0937FE0D3A7A0FE29A /* Frameworks */, + 857F0DEA1890CE66D6DAD556 /* Products */, + ); + sourceTree = ""; + }; + 67BF3478113E6B4DF1C4E04F /* OpenAPIs */ = { + isa = PBXGroup; + children = ( + 84A201508DF2B697D65F2631 /* AlamofireImplementations.swift */, + 897716962D472FE162B723CB /* APIHelper.swift */, + 37DF825B8F3BADA2B2537D17 /* APIs.swift */, + 02A6F6BB2152ACEE1416D44A /* CodableHelper.swift */, + 28A444949BBC254798C3B3DD /* Configuration.swift */, + B8C298FC8929DCB369053F11 /* Extensions.swift */, + 9791B840B8D6EAA35343B00F /* JSONEncodableEncoding.swift */, + 35D710108A69DD8A5297F926 /* JSONEncodingHelper.swift */, + 8699F7966F748ED026A6FB4C /* Models.swift */, + 099A5E845AF5E1409204325B /* Result.swift */, + F956D0CCAE23BCFD1C7BDD5D /* APIs */, + 4FBDCF1330A9AB9122780DB3 /* Models */, + ); + path = OpenAPIs; + sourceTree = ""; + }; + 7861EE241895128F64DD7873 /* Carthage */ = { + isa = PBXGroup; + children = ( + A012205B41CB71A62B86EECD /* iOS */, + ); + name = Carthage; + path = Carthage/Build; + sourceTree = ""; + }; + 857F0DEA1890CE66D6DAD556 /* Products */ = { + isa = PBXGroup; + children = ( + 164AD6EC9C4CCF634D7C4590 /* PetstoreClient.framework */, + ); + name = Products; + sourceTree = ""; + }; + 9B364C01750D7AA4F983B9E7 /* PetstoreClient */ = { + isa = PBXGroup; + children = ( + EF4C81BDD734856ED5023B77 /* Classes */, + ); + path = PetstoreClient; + sourceTree = ""; + }; + A012205B41CB71A62B86EECD /* iOS */ = { + isa = PBXGroup; + children = ( + A235FA3FDFB086CC69CDE83D /* Alamofire.framework */, + ); + path = iOS; + sourceTree = ""; + }; + EF4C81BDD734856ED5023B77 /* Classes */ = { + isa = PBXGroup; + children = ( + 67BF3478113E6B4DF1C4E04F /* OpenAPIs */, + ); + path = Classes; + sourceTree = ""; + }; + F956D0CCAE23BCFD1C7BDD5D /* APIs */ = { + isa = PBXGroup; + children = ( + 9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */, + 6E00950725DC44436C5E238C /* FakeAPI.swift */, + B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */, + 9A019F500E546A3292CE716A /* PetAPI.swift */, + A53274D99BBDE1B79BF3521C /* StoreAPI.swift */, + 7C8D5F382979854D47F18DB1 /* UserAPI.swift */, + ); + path = APIs; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C1282C2230015E0D204BEAED /* PetstoreClient */ = { + isa = PBXNativeTarget; + buildConfigurationList = B46EDEB1A7F0D78FE6394544 /* Build configuration list for PBXNativeTarget "PetstoreClient" */; + buildPhases = ( + E539708354CE60FE486F81ED /* Sources */, + D1990C2A394CCF025EF98A2F /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PetstoreClient; + productName = PetstoreClient; + productReference = 164AD6EC9C4CCF634D7C4590 /* PetstoreClient.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E7D276EE2369D8C455513C2E /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + }; + buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; + compatibilityVersion = "Xcode 10.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = 5FBA6AE5F64CD737F88B4565; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C1282C2230015E0D204BEAED /* PetstoreClient */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + E539708354CE60FE486F81ED /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1E6C7C7F271A802DF8099330 /* APIHelper.swift in Sources */, + 40E3027D2E38D8329C6AB01F /* APIs.swift in Sources */, + 248F2F0F29E8FDAE9CAD64C5 /* AdditionalPropertiesClass.swift in Sources */, + 40E46046D2B16D1A672A08E3 /* AlamofireImplementations.swift in Sources */, + 2B441CDFFFDDB343C04F5375 /* Animal.swift in Sources */, + 45B3B29D7A62049F824751F8 /* AnimalFarm.swift in Sources */, + CA9B9B19882EA044EAD0B359 /* AnotherFakeAPI.swift in Sources */, + 0299339D13C3571C4C57368A /* ApiResponse.swift in Sources */, + 4B4BE77747413A9188CDABD2 /* ArrayOfArrayOfNumberOnly.swift in Sources */, + 3691B017D3AA18404A563C67 /* ArrayOfNumberOnly.swift in Sources */, + A85E190556818FFA79896E92 /* ArrayTest.swift in Sources */, + BB1F3C6D50B8F0A8CC4F1749 /* Capitalization.swift in Sources */, + D95A5F83AAA7D5C95A29AB83 /* Cat.swift in Sources */, + 4A344DF7ECE721B4BBEDCB4A /* CatAllOf.swift in Sources */, + E8A58C6414E88AF3EAE45B69 /* Category.swift in Sources */, + 7441BBA84C31E06400338F89 /* ClassModel.swift in Sources */, + AD594BFB99E31A5E07579237 /* Client.swift in Sources */, + 6FBD978F4D1ED92E7071FFBB /* CodableHelper.swift in Sources */, + 72547ECFB451A509409311EE /* Configuration.swift in Sources */, + 0C1E4C682F2D0AF7D9E431EE /* Dog.swift in Sources */, + 72CE544C52BB33778D1B89B8 /* DogAllOf.swift in Sources */, + 61322FC4325F1A4FF24ACA48 /* EnumArrays.swift in Sources */, + ACF3037926301D4D6E848745 /* EnumClass.swift in Sources */, + 9DA1C6F8B4D6C8595F28C098 /* EnumTest.swift in Sources */, + 269E3103C458C78EA5726EE2 /* Extensions.swift in Sources */, + DDBD4C0FBA3CD6A4DA3DF376 /* FakeAPI.swift in Sources */, + 34C26979F4678B5B579D26E8 /* FakeClassnameTags123API.swift in Sources */, + 97F7B85BF07A325EEBF92C93 /* File.swift in Sources */, + DDF1D589267D56D9BED3C6E5 /* FileSchemaTestClass.swift in Sources */, + 6B638A04B34C82B2091D6EDD /* FormatTest.swift in Sources */, + 86DE714469BE8BA28AFF710F /* HasOnlyReadOnly.swift in Sources */, + 22FA6CA58E58550DE36AE750 /* JSONEncodableEncoding.swift in Sources */, + 7588B7E2960253174ADCCF16 /* JSONEncodingHelper.swift in Sources */, + 9CA19AA4483F6EB50270A81E /* List.swift in Sources */, + 081C0B80A989B1AAF2665121 /* MapTest.swift in Sources */, + B301DB1B80F37C757550AA17 /* MixedPropertiesAndAdditionalPropertiesClass.swift in Sources */, + 9CF06ACDA32CB0C3E74E435C /* Model200Response.swift in Sources */, + D3BAB7C7A607392CA838C580 /* Models.swift in Sources */, + 37DEADD6CD0496690725B8A7 /* Name.swift in Sources */, + 555DEA47352B42E49082922B /* NumberOnly.swift in Sources */, + 0E6932F1C55BA6880693C478 /* Order.swift in Sources */, + 922BDADAB291907A7FD14314 /* OuterComposite.swift in Sources */, + 41A491E9B577C510F927D126 /* OuterEnum.swift in Sources */, + 2C29D5B60E00DDA3878F1BDE /* Pet.swift in Sources */, + A6E5A5629495DB0ED672B06F /* PetAPI.swift in Sources */, + 914F4D1FCB17773C067C4E68 /* ReadOnlyFirst.swift in Sources */, + 913B0BA470D8357FF8A2FFD3 /* Result.swift in Sources */, + A6E50CC6845FE58D8C236253 /* Return.swift in Sources */, + 294CDFA409BC369C0FDC5FB3 /* SpecialModelName.swift in Sources */, + CB68ABDBAADAF6B8D7B93A5D /* StoreAPI.swift in Sources */, + EDFC6C5121A43997014049CB /* StringBooleanMap.swift in Sources */, + B3E35FE2773D4A8BA15CFA88 /* Tag.swift in Sources */, + 5695497F5DBF6C08842755A3 /* TypeHolderDefault.swift in Sources */, + FECA2E8C9D0BDFEC459E8996 /* TypeHolderExample.swift in Sources */, + 31DFF71D8CCCA0D2D2F8AC90 /* User.swift in Sources */, + 64C48E3658CF53EBE8AF82F9 /* UserAPI.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 3B2C02AFB91CB5C82766ED5C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; + A9EB0A02B94C427CBACFEC7C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + DD3EEB93949E9EBA4437E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + F81D4E5FECD46E9AA6DD2C29 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B46EDEB1A7F0D78FE6394544 /* Build configuration list for PBXNativeTarget "PetstoreClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DD3EEB93949E9EBA4437E9CD /* Debug */, + 3B2C02AFB91CB5C82766ED5C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ""; + }; + ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A9EB0A02B94C427CBACFEC7C /* Debug */, + F81D4E5FECD46E9AA6DD2C29 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = E7D276EE2369D8C455513C2E /* Project object */; +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..919434a6254 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme new file mode 100644 index 00000000000..26d510552bb --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift new file mode 100644 index 00000000000..20007009680 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -0,0 +1,70 @@ +// APIHelper.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct APIHelper { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { + let destination = source.reduce(into: [String: Any]()) { (result, item) in + if let value = item.value { + result[item.key] = value + } + } + + if destination.isEmpty { + return nil + } + return destination + } + + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { + return source.reduce(into: [String: String]()) { (result, item) in + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") + } else if let value: Any = item.value { + result[item.key] = "\(value)" + } + } + } + + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { + guard let source = source else { + return nil + } + + return source.reduce(into: [String: Any](), { (result, item) in + switch item.value { + case let x as Bool: + result[item.key] = x.description + default: + result[item.key] = item.value + } + }) + } + + public static func mapValueToPathItem(_ source: Any) -> Any { + if let collection = source as? [Any?] { + return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") + } + return source + } + + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { + let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in + if let collection = item.value as? [Any?] { + let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") + result.append(URLQueryItem(name: item.key, value: value)) + } else if let value = item.value { + result.append(URLQueryItem(name: item.key, value: "\(value)")) + } + } + + if destination.isEmpty { + return nil + } + return destination + } +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift new file mode 100644 index 00000000000..9e4312f685d --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -0,0 +1,61 @@ +// APIs.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class PetstoreClientAPI { + public static var basePath = "http://petstore.swagger.io:80/v2" + public static var credential: URLCredential? + public static var customHeaders: [String: String] = [:] + public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() +} + +open class RequestBuilder { + var credential: URLCredential? + var headers: [String: String] + public let parameters: [String: Any]? + public let isBody: Bool + public let method: String + public let URLString: String + + /// Optional block to obtain a reference to the request's progress instance when available. + public var onProgressReady: ((Progress) -> Void)? + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { + self.method = method + self.URLString = URLString + self.parameters = parameters + self.isBody = isBody + self.headers = headers + + addHeaders(PetstoreClientAPI.customHeaders) + } + + open func addHeaders(_ aHeaders: [String: String]) { + for (header, value) in aHeaders { + headers[header] = value + } + } + + open func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { } + + public func addHeader(name: String, value: String) -> Self { + if !value.isEmpty { + headers[name] = value + } + return self + } + + open func addCredential() -> Self { + self.credential = PetstoreClientAPI.credential + return self + } +} + +public protocol RequestBuilderFactory { + func getNonDecodableBuilder() -> RequestBuilder.Type + func getBuilder() -> RequestBuilder.Type +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift new file mode 100644 index 00000000000..fb4bb8cfdb4 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -0,0 +1,59 @@ +// +// AnotherFakeAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class AnotherFakeAPI { + /** + To test special tags + + - parameter body: (body) client model + - parameter completion: completion handler to receive the data and the error objects + */ + open class func call123testSpecialTags(body: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + call123testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + To test special tags + + - parameter body: (body) client model + - parameter completion: completion handler to receive the result + */ + open class func call123testSpecialTags(body: Client, completion: @escaping ((_ result: Result) -> Void)) { + call123testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + To test special tags + - PATCH /another-fake/dummy + - To test special tags and operation ID starting with number + - parameter body: (body) client model + - returns: RequestBuilder + */ + open class func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder { + let path = "/another-fake/dummy" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift new file mode 100644 index 00000000000..adfc6341ece --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -0,0 +1,786 @@ +// +// FakeAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class FakeAPI { + /** + + - parameter body: (body) Input boolean as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterBooleanSerialize(body: Bool? = nil, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { + fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + + - parameter body: (body) Input boolean as post body (optional) + - parameter completion: completion handler to receive the result + */ + open class func fakeOuterBooleanSerialize(body: Bool? = nil, completion: @escaping ((_ result: Result) -> Void)) { + fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + - POST /fake/outer/boolean + - Test serialization of outer boolean types + - parameter body: (body) Input boolean as post body (optional) + - returns: RequestBuilder + */ + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil) -> RequestBuilder { + let path = "/fake/outer/boolean" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input composite as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { + fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + + - parameter body: (body) Input composite as post body (optional) + - parameter completion: completion handler to receive the result + */ + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ result: Result) -> Void)) { + fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + - POST /fake/outer/composite + - Test serialization of object with outer number type + - parameter body: (body) Input composite as post body (optional) + - returns: RequestBuilder + */ + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder { + let path = "/fake/outer/composite" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input number as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterNumberSerialize(body: Double? = nil, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { + fakeOuterNumberSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + + - parameter body: (body) Input number as post body (optional) + - parameter completion: completion handler to receive the result + */ + open class func fakeOuterNumberSerialize(body: Double? = nil, completion: @escaping ((_ result: Result) -> Void)) { + fakeOuterNumberSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + - POST /fake/outer/number + - Test serialization of outer number types + - parameter body: (body) Input number as post body (optional) + - returns: RequestBuilder + */ + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil) -> RequestBuilder { + let path = "/fake/outer/number" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input string as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterStringSerialize(body: String? = nil, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { + fakeOuterStringSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + + - parameter body: (body) Input string as post body (optional) + - parameter completion: completion handler to receive the result + */ + open class func fakeOuterStringSerialize(body: String? = nil, completion: @escaping ((_ result: Result) -> Void)) { + fakeOuterStringSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + - POST /fake/outer/string + - Test serialization of outer string types + - parameter body: (body) Input string as post body (optional) + - returns: RequestBuilder + */ + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil) -> RequestBuilder { + let path = "/fake/outer/string" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testBodyWithFileSchema(body: FileSchemaTestClass, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testBodyWithFileSchemaWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + + - parameter body: (body) + - parameter completion: completion handler to receive the result + */ + open class func testBodyWithFileSchema(body: FileSchemaTestClass, completion: @escaping ((_ result: Result) -> Void)) { + testBodyWithFileSchemaWithRequestBuilder(body: body).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + - PUT /fake/body-with-file-schema + - For this test, the body for this request much reference a schema named `File`. + - parameter body: (body) + - returns: RequestBuilder + */ + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder { + let path = "/fake/body-with-file-schema" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter query: (query) + - parameter body: (body) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testBodyWithQueryParams(query: String, body: User, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + + - parameter query: (query) + - parameter body: (body) + - parameter completion: completion handler to receive the result + */ + open class func testBodyWithQueryParams(query: String, body: User, completion: @escaping ((_ result: Result) -> Void)) { + testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + - PUT /fake/body-with-query-params + - parameter query: (query) + - parameter body: (body) + - returns: RequestBuilder + */ + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder { + let path = "/fake/body-with-query-params" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "query": query + ]) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + To test \"client\" model + + - parameter body: (body) client model + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testClientModel(body: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + To test \"client\" model + + - parameter body: (body) client model + - parameter completion: completion handler to receive the result + */ + open class func testClientModel(body: Client, completion: @escaping ((_ result: Result) -> Void)) { + testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + To test \"client\" model + - PATCH /fake + - To test \"client\" model + - parameter body: (body) client model + - returns: RequestBuilder + */ + open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + + - parameter number: (form) None + - parameter double: (form) None + - parameter patternWithoutDelimiter: (form) None + - parameter byte: (form) None + - parameter integer: (form) None (optional) + - parameter int32: (form) None (optional) + - parameter int64: (form) None (optional) + - parameter float: (form) None (optional) + - parameter string: (form) None (optional) + - parameter binary: (form) None (optional) + - parameter date: (form) None (optional) + - parameter dateTime: (form) None (optional) + - parameter password: (form) None (optional) + - parameter callback: (form) None (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + + - parameter number: (form) None + - parameter double: (form) None + - parameter patternWithoutDelimiter: (form) None + - parameter byte: (form) None + - parameter integer: (form) None (optional) + - parameter int32: (form) None (optional) + - parameter int64: (form) None (optional) + - parameter float: (form) None (optional) + - parameter string: (form) None (optional) + - parameter binary: (form) None (optional) + - parameter date: (form) None (optional) + - parameter dateTime: (form) None (optional) + - parameter password: (form) None (optional) + - parameter callback: (form) None (optional) + - parameter completion: completion handler to receive the result + */ + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping ((_ result: Result) -> Void)) { + testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + - POST /fake + - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + - BASIC: + - type: http + - name: http_basic_test + - parameter number: (form) None + - parameter double: (form) None + - parameter patternWithoutDelimiter: (form) None + - parameter byte: (form) None + - parameter integer: (form) None (optional) + - parameter int32: (form) None (optional) + - parameter int64: (form) None (optional) + - parameter float: (form) None (optional) + - parameter string: (form) None (optional) + - parameter binary: (form) None (optional) + - parameter date: (form) None (optional) + - parameter dateTime: (form) None (optional) + - parameter password: (form) None (optional) + - parameter callback: (form) None (optional) + - returns: RequestBuilder + */ + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "integer": integer?.encodeToJSON(), + "int32": int32?.encodeToJSON(), + "int64": int64?.encodeToJSON(), + "number": number, + "float": float, + "double": double, + "string": string, + "pattern_without_delimiter": patternWithoutDelimiter, + "byte": byte, + "binary": binary, + "date": date?.encodeToJSON(), + "dateTime": dateTime?.encodeToJSON(), + "password": password, + "callback": callback + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + * enum for parameter enumHeaderStringArray + */ + public enum EnumHeaderStringArray_testEnumParameters: String { + case greaterThan = ">" + case dollar = "$" + } + + /** + * enum for parameter enumHeaderString + */ + public enum EnumHeaderString_testEnumParameters: String { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" + } + + /** + * enum for parameter enumQueryStringArray + */ + public enum EnumQueryStringArray_testEnumParameters: String { + case greaterThan = ">" + case dollar = "$" + } + + /** + * enum for parameter enumQueryString + */ + public enum EnumQueryString_testEnumParameters: String { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" + } + + /** + * enum for parameter enumQueryInteger + */ + public enum EnumQueryInteger_testEnumParameters: Int { + case _1 = 1 + case number2 = -2 + } + + /** + * enum for parameter enumQueryDouble + */ + public enum EnumQueryDouble_testEnumParameters: Double { + case _11 = 1.1 + case number12 = -1.2 + } + + /** + * enum for parameter enumFormStringArray + */ + public enum EnumFormStringArray_testEnumParameters: String { + case greaterThan = ">" + case dollar = "$" + } + + /** + * enum for parameter enumFormString + */ + public enum EnumFormString_testEnumParameters: String { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" + } + + /** + To test enum parameters + + - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) + - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) + - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) + - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + To test enum parameters + + - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) + - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) + - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) + - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) + - parameter completion: completion handler to receive the result + */ + open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, completion: @escaping ((_ result: Result) -> Void)) { + testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + To test enum parameters + - GET /fake + - To test enum parameters + - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) + - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) + - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) + - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) + - returns: RequestBuilder + */ + open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "enum_form_string_array": enumFormStringArray, + "enum_form_string": enumFormString?.rawValue + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "enum_query_string_array": enumQueryStringArray, + "enum_query_string": enumQueryString?.rawValue, + "enum_query_integer": enumQueryInteger?.rawValue, + "enum_query_double": enumQueryDouble?.rawValue + ]) + let nillableHeaders: [String: Any?] = [ + "enum_header_string_array": enumHeaderStringArray, + "enum_header_string": enumHeaderString?.rawValue + ] + let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) + } + + /** + Fake endpoint to test group parameters (optional) + + - parameter requiredStringGroup: (query) Required String in group parameters + - parameter requiredBooleanGroup: (header) Required Boolean in group parameters + - parameter requiredInt64Group: (query) Required Integer in group parameters + - parameter stringGroup: (query) String in group parameters (optional) + - parameter booleanGroup: (header) Boolean in group parameters (optional) + - parameter int64Group: (query) Integer in group parameters (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Fake endpoint to test group parameters (optional) + + - parameter requiredStringGroup: (query) Required String in group parameters + - parameter requiredBooleanGroup: (header) Required Boolean in group parameters + - parameter requiredInt64Group: (query) Required Integer in group parameters + - parameter stringGroup: (query) String in group parameters (optional) + - parameter booleanGroup: (header) Boolean in group parameters (optional) + - parameter int64Group: (query) Integer in group parameters (optional) + - parameter completion: completion handler to receive the result + */ + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, completion: @escaping ((_ result: Result) -> Void)) { + testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Fake endpoint to test group parameters (optional) + - DELETE /fake + - Fake endpoint to test group parameters (optional) + - parameter requiredStringGroup: (query) Required String in group parameters + - parameter requiredBooleanGroup: (header) Required Boolean in group parameters + - parameter requiredInt64Group: (query) Required Integer in group parameters + - parameter stringGroup: (query) String in group parameters (optional) + - parameter booleanGroup: (header) Boolean in group parameters (optional) + - parameter int64Group: (query) Integer in group parameters (optional) + - returns: RequestBuilder + */ + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), + "int64_group": int64Group?.encodeToJSON() + ]) + let nillableHeaders: [String: Any?] = [ + "required_boolean_group": requiredBooleanGroup, + "boolean_group": booleanGroup + ] + let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) + } + + /** + test inline additionalProperties + + - parameter param: (body) request body + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testInlineAdditionalProperties(param: [String: String], completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + test inline additionalProperties + + - parameter param: (body) request body + - parameter completion: completion handler to receive the result + */ + open class func testInlineAdditionalProperties(param: [String: String], completion: @escaping ((_ result: Result) -> Void)) { + testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + test inline additionalProperties + - POST /fake/inline-additionalProperties + - parameter param: (body) request body + - returns: RequestBuilder + */ + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder { + let path = "/fake/inline-additionalProperties" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + test json serialization of form data + + - parameter param: (form) field1 + - parameter param2: (form) field2 + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testJsonFormData(param: String, param2: String, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + test json serialization of form data + + - parameter param: (form) field1 + - parameter param2: (form) field2 + - parameter completion: completion handler to receive the result + */ + open class func testJsonFormData(param: String, param2: String, completion: @escaping ((_ result: Result) -> Void)) { + testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + test json serialization of form data + - GET /fake/jsonFormData + - parameter param: (form) field1 + - parameter param2: (form) field2 + - returns: RequestBuilder + */ + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder { + let path = "/fake/jsonFormData" + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "param": param, + "param2": param2 + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift new file mode 100644 index 00000000000..09c9696dec6 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -0,0 +1,62 @@ +// +// FakeClassnameTags123API.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class FakeClassnameTags123API { + /** + To test class name in snake case + + - parameter body: (body) client model + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testClassname(body: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + To test class name in snake case + + - parameter body: (body) client model + - parameter completion: completion handler to receive the result + */ + open class func testClassname(body: Client, completion: @escaping ((_ result: Result) -> Void)) { + testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + To test class name in snake case + - PATCH /fake_classname_test + - To test class name in snake case + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query + - parameter body: (body) client model + - returns: RequestBuilder + */ + open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder { + let path = "/fake_classname_test" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift new file mode 100644 index 00000000000..c8f66b41e87 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -0,0 +1,545 @@ +// +// PetAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class PetAPI { + /** + Add a new pet to the store + + - parameter body: (body) Pet object that needs to be added to the store + - parameter completion: completion handler to receive the data and the error objects + */ + open class func addPet(body: Pet, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + addPetWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Add a new pet to the store + + - parameter body: (body) Pet object that needs to be added to the store + - parameter completion: completion handler to receive the result + */ + open class func addPet(body: Pet, completion: @escaping ((_ result: Result) -> Void)) { + addPetWithRequestBuilder(body: body).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Add a new pet to the store + - POST /pet + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter body: (body) Pet object that needs to be added to the store + - returns: RequestBuilder + */ + open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder { + let path = "/pet" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Deletes a pet + + - parameter petId: (path) Pet id to delete + - parameter apiKey: (header) (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func deletePet(petId: Int64, apiKey: String? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Deletes a pet + + - parameter petId: (path) Pet id to delete + - parameter apiKey: (header) (optional) + - parameter completion: completion handler to receive the result + */ + open class func deletePet(petId: Int64, apiKey: String? = nil, completion: @escaping ((_ result: Result) -> Void)) { + deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Deletes a pet + - DELETE /pet/{petId} + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) Pet id to delete + - parameter apiKey: (header) (optional) + - returns: RequestBuilder + */ + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder { + var path = "/pet/{petId}" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + let nillableHeaders: [String: Any?] = [ + "api_key": apiKey + ] + let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) + } + + /** + * enum for parameter status + */ + public enum Status_findPetsByStatus: String { + case available = "available" + case pending = "pending" + case sold = "sold" + } + + /** + Finds Pets by status + + - parameter status: (query) Status values that need to be considered for filter + - parameter completion: completion handler to receive the data and the error objects + */ + open class func findPetsByStatus(status: [String], completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { + findPetsByStatusWithRequestBuilder(status: status).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + Finds Pets by status + + - parameter status: (query) Status values that need to be considered for filter + - parameter completion: completion handler to receive the result + */ + open class func findPetsByStatus(status: [String], completion: @escaping ((_ result: Result<[Pet], Error>) -> Void)) { + findPetsByStatusWithRequestBuilder(status: status).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + Finds Pets by status + - GET /pet/findByStatus + - Multiple status values can be provided with comma separated strings + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter status: (query) Status values that need to be considered for filter + - returns: RequestBuilder<[Pet]> + */ + open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { + let path = "/pet/findByStatus" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "status": status + ]) + + let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Finds Pets by tags + + - parameter tags: (query) Tags to filter by + - parameter completion: completion handler to receive the data and the error objects + */ + open class func findPetsByTags(tags: [String], completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { + findPetsByTagsWithRequestBuilder(tags: tags).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + Finds Pets by tags + + - parameter tags: (query) Tags to filter by + - parameter completion: completion handler to receive the result + */ + open class func findPetsByTags(tags: [String], completion: @escaping ((_ result: Result<[Pet], Error>) -> Void)) { + findPetsByTagsWithRequestBuilder(tags: tags).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + Finds Pets by tags + - GET /pet/findByTags + - Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter tags: (query) Tags to filter by + - returns: RequestBuilder<[Pet]> + */ + open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { + let path = "/pet/findByTags" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "tags": tags + ]) + + let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Find pet by ID + + - parameter petId: (path) ID of pet to return + - parameter completion: completion handler to receive the data and the error objects + */ + open class func getPetById(petId: Int64, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { + getPetByIdWithRequestBuilder(petId: petId).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + Find pet by ID + + - parameter petId: (path) ID of pet to return + - parameter completion: completion handler to receive the result + */ + open class func getPetById(petId: Int64, completion: @escaping ((_ result: Result) -> Void)) { + getPetByIdWithRequestBuilder(petId: petId).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + Find pet by ID + - GET /pet/{petId} + - Returns a single pet + - API Key: + - type: apiKey api_key + - name: api_key + - parameter petId: (path) ID of pet to return + - returns: RequestBuilder + */ + open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder { + var path = "/pet/{petId}" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Update an existing pet + + - parameter body: (body) Pet object that needs to be added to the store + - parameter completion: completion handler to receive the data and the error objects + */ + open class func updatePet(body: Pet, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updatePetWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Update an existing pet + + - parameter body: (body) Pet object that needs to be added to the store + - parameter completion: completion handler to receive the result + */ + open class func updatePet(body: Pet, completion: @escaping ((_ result: Result) -> Void)) { + updatePetWithRequestBuilder(body: body).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Update an existing pet + - PUT /pet + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter body: (body) Pet object that needs to be added to the store + - returns: RequestBuilder + */ + open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder { + let path = "/pet" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Updates a pet in the store with form data + + - parameter petId: (path) ID of pet that needs to be updated + - parameter name: (form) Updated name of the pet (optional) + - parameter status: (form) Updated status of the pet (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Updates a pet in the store with form data + + - parameter petId: (path) ID of pet that needs to be updated + - parameter name: (form) Updated name of the pet (optional) + - parameter status: (form) Updated status of the pet (optional) + - parameter completion: completion handler to receive the result + */ + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, completion: @escaping ((_ result: Result) -> Void)) { + updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Updates a pet in the store with form data + - POST /pet/{petId} + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet that needs to be updated + - parameter name: (form) Updated name of the pet (optional) + - parameter status: (form) Updated status of the pet (optional) + - returns: RequestBuilder + */ + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder { + var path = "/pet/{petId}" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "name": name, + "status": status + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + uploads an image + + - parameter petId: (path) ID of pet to update + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter file: (form) file to upload (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + uploads an image + + - parameter petId: (path) ID of pet to update + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter file: (form) file to upload (optional) + - parameter completion: completion handler to receive the result + */ + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping ((_ result: Result) -> Void)) { + uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + uploads an image + - POST /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter file: (form) file to upload (optional) + - returns: RequestBuilder + */ + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + var path = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "additionalMetadata": additionalMetadata, + "file": file + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + uploads an image (required) + + - parameter petId: (path) ID of pet to update + - parameter requiredFile: (form) file to upload + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + uploads an image (required) + + - parameter petId: (path) ID of pet to update + - parameter requiredFile: (form) file to upload + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter completion: completion handler to receive the result + */ + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping ((_ result: Result) -> Void)) { + uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + uploads an image (required) + - POST /fake/{petId}/uploadImageWithRequiredFile + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter requiredFile: (form) file to upload + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - returns: RequestBuilder + */ + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + var path = "/fake/{petId}/uploadImageWithRequiredFile" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "additionalMetadata": additionalMetadata, + "requiredFile": requiredFile + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift new file mode 100644 index 00000000000..62ae519105c --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -0,0 +1,210 @@ +// +// StoreAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class StoreAPI { + /** + Delete purchase order by ID + + - parameter orderId: (path) ID of the order that needs to be deleted + - parameter completion: completion handler to receive the data and the error objects + */ + open class func deleteOrder(orderId: String, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + deleteOrderWithRequestBuilder(orderId: orderId).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Delete purchase order by ID + + - parameter orderId: (path) ID of the order that needs to be deleted + - parameter completion: completion handler to receive the result + */ + open class func deleteOrder(orderId: String, completion: @escaping ((_ result: Result) -> Void)) { + deleteOrderWithRequestBuilder(orderId: orderId).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Delete purchase order by ID + - DELETE /store/order/{order_id} + - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + - parameter orderId: (path) ID of the order that needs to be deleted + - returns: RequestBuilder + */ + open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder { + var path = "/store/order/{order_id}" + let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" + let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Returns pet inventories by status + + - parameter completion: completion handler to receive the data and the error objects + */ + open class func getInventory(completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { + getInventoryWithRequestBuilder().execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + Returns pet inventories by status + + - parameter completion: completion handler to receive the result + */ + open class func getInventory(completion: @escaping ((_ result: Result<[String: Int], Error>) -> Void)) { + getInventoryWithRequestBuilder().execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + Returns pet inventories by status + - GET /store/inventory + - Returns a map of status codes to quantities + - API Key: + - type: apiKey api_key + - name: api_key + - returns: RequestBuilder<[String:Int]> + */ + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { + let path = "/store/inventory" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Find purchase order by ID + + - parameter orderId: (path) ID of pet that needs to be fetched + - parameter completion: completion handler to receive the data and the error objects + */ + open class func getOrderById(orderId: Int64, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { + getOrderByIdWithRequestBuilder(orderId: orderId).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + Find purchase order by ID + + - parameter orderId: (path) ID of pet that needs to be fetched + - parameter completion: completion handler to receive the result + */ + open class func getOrderById(orderId: Int64, completion: @escaping ((_ result: Result) -> Void)) { + getOrderByIdWithRequestBuilder(orderId: orderId).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + Find purchase order by ID + - GET /store/order/{order_id} + - For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + - parameter orderId: (path) ID of pet that needs to be fetched + - returns: RequestBuilder + */ + open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder { + var path = "/store/order/{order_id}" + let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" + let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Place an order for a pet + + - parameter body: (body) order placed for purchasing the pet + - parameter completion: completion handler to receive the data and the error objects + */ + open class func placeOrder(body: Order, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { + placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + Place an order for a pet + + - parameter body: (body) order placed for purchasing the pet + - parameter completion: completion handler to receive the result + */ + open class func placeOrder(body: Order, completion: @escaping ((_ result: Result) -> Void)) { + placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + Place an order for a pet + - POST /store/order + - parameter body: (body) order placed for purchasing the pet + - returns: RequestBuilder + */ + open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder { + let path = "/store/order" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift new file mode 100644 index 00000000000..d0971feb2c1 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -0,0 +1,419 @@ +// +// UserAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class UserAPI { + /** + Create user + + - parameter body: (body) Created user object + - parameter completion: completion handler to receive the data and the error objects + */ + open class func createUser(body: User, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUserWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Create user + + - parameter body: (body) Created user object + - parameter completion: completion handler to receive the result + */ + open class func createUser(body: User, completion: @escaping ((_ result: Result) -> Void)) { + createUserWithRequestBuilder(body: body).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Create user + - POST /user + - This can only be done by the logged in user. + - parameter body: (body) Created user object + - returns: RequestBuilder + */ + open class func createUserWithRequestBuilder(body: User) -> RequestBuilder { + let path = "/user" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Creates list of users with given input array + + - parameter body: (body) List of user object + - parameter completion: completion handler to receive the data and the error objects + */ + open class func createUsersWithArrayInput(body: [User], completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUsersWithArrayInputWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Creates list of users with given input array + + - parameter body: (body) List of user object + - parameter completion: completion handler to receive the result + */ + open class func createUsersWithArrayInput(body: [User], completion: @escaping ((_ result: Result) -> Void)) { + createUsersWithArrayInputWithRequestBuilder(body: body).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Creates list of users with given input array + - POST /user/createWithArray + - parameter body: (body) List of user object + - returns: RequestBuilder + */ + open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder { + let path = "/user/createWithArray" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Creates list of users with given input array + + - parameter body: (body) List of user object + - parameter completion: completion handler to receive the data and the error objects + */ + open class func createUsersWithListInput(body: [User], completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUsersWithListInputWithRequestBuilder(body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Creates list of users with given input array + + - parameter body: (body) List of user object + - parameter completion: completion handler to receive the result + */ + open class func createUsersWithListInput(body: [User], completion: @escaping ((_ result: Result) -> Void)) { + createUsersWithListInputWithRequestBuilder(body: body).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Creates list of users with given input array + - POST /user/createWithList + - parameter body: (body) List of user object + - returns: RequestBuilder + */ + open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder { + let path = "/user/createWithList" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Delete user + + - parameter username: (path) The name that needs to be deleted + - parameter completion: completion handler to receive the data and the error objects + */ + open class func deleteUser(username: String, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + deleteUserWithRequestBuilder(username: username).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Delete user + + - parameter username: (path) The name that needs to be deleted + - parameter completion: completion handler to receive the result + */ + open class func deleteUser(username: String, completion: @escaping ((_ result: Result) -> Void)) { + deleteUserWithRequestBuilder(username: username).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Delete user + - DELETE /user/{username} + - This can only be done by the logged in user. + - parameter username: (path) The name that needs to be deleted + - returns: RequestBuilder + */ + open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder { + var path = "/user/{username}" + let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" + let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get user by user name + + - parameter username: (path) The name that needs to be fetched. Use user1 for testing. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func getUserByName(username: String, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { + getUserByNameWithRequestBuilder(username: username).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + Get user by user name + + - parameter username: (path) The name that needs to be fetched. Use user1 for testing. + - parameter completion: completion handler to receive the result + */ + open class func getUserByName(username: String, completion: @escaping ((_ result: Result) -> Void)) { + getUserByNameWithRequestBuilder(username: username).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + Get user by user name + - GET /user/{username} + - parameter username: (path) The name that needs to be fetched. Use user1 for testing. + - returns: RequestBuilder + */ + open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder { + var path = "/user/{username}" + let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" + let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Logs user into the system + + - parameter username: (query) The user name for login + - parameter password: (query) The password for login in clear text + - parameter completion: completion handler to receive the data and the error objects + */ + open class func loginUser(username: String, password: String, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { + loginUserWithRequestBuilder(username: username, password: password).execute { (response, error) -> Void in + completion(response?.body, error) + } + } + /** + Logs user into the system + + - parameter username: (query) The user name for login + - parameter password: (query) The password for login in clear text + - parameter completion: completion handler to receive the result + */ + open class func loginUser(username: String, password: String, completion: @escaping ((_ result: Result) -> Void)) { + loginUserWithRequestBuilder(username: username, password: password).execute { (response, error) -> Void in + if let error = error { + completion(.failure(error)) + } else if let response = response { + completion(.success(response.body!)) + } else { + fatalError() + } + } + } + + /** + Logs user into the system + - GET /user/login + - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] + - parameter username: (query) The user name for login + - parameter password: (query) The password for login in clear text + - returns: RequestBuilder + */ + open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder { + let path = "/user/login" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "username": username, + "password": password + ]) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Logs out current logged in user session + + - parameter completion: completion handler to receive the data and the error objects + */ + open class func logoutUser(completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + logoutUserWithRequestBuilder().execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Logs out current logged in user session + + - parameter completion: completion handler to receive the result + */ + open class func logoutUser(completion: @escaping ((_ result: Result) -> Void)) { + logoutUserWithRequestBuilder().execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Logs out current logged in user session + - GET /user/logout + - returns: RequestBuilder + */ + open class func logoutUserWithRequestBuilder() -> RequestBuilder { + let path = "/user/logout" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Updated user + + - parameter username: (path) name that need to be deleted + - parameter body: (body) Updated user object + - parameter completion: completion handler to receive the data and the error objects + */ + open class func updateUser(username: String, body: User, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updateUserWithRequestBuilder(username: username, body: body).execute { (_, error) -> Void in + if error == nil { + completion((), error) + } else { + completion(nil, error) + } + } + } + /** + Updated user + + - parameter username: (path) name that need to be deleted + - parameter body: (body) Updated user object + - parameter completion: completion handler to receive the result + */ + open class func updateUser(username: String, body: User, completion: @escaping ((_ result: Result) -> Void)) { + updateUserWithRequestBuilder(username: username, body: body).execute { (_, error) -> Void in + if let error = error { + completion(.failure(error)) + } else { + completion(.success(())) + } + } + } + + /** + Updated user + - PUT /user/{username} + - This can only be done by the logged in user. + - parameter username: (path) name that need to be deleted + - parameter body: (body) Updated user object + - returns: RequestBuilder + */ + open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder { + var path = "/user/{username}" + let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" + let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift new file mode 100644 index 00000000000..60ce28c66a2 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -0,0 +1,450 @@ +// AlamofireImplementations.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation +import Alamofire + +class AlamofireRequestBuilderFactory: RequestBuilderFactory { + func getNonDecodableBuilder() -> RequestBuilder.Type { + return AlamofireRequestBuilder.self + } + + func getBuilder() -> RequestBuilder.Type { + return AlamofireDecodableRequestBuilder.self + } +} + +private struct SynchronizedDictionary { + + private var dictionary = [K: V]() + private let queue = DispatchQueue( + label: "SynchronizedDictionary", + qos: DispatchQoS.userInitiated, + attributes: [DispatchQueue.Attributes.concurrent], + autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency.inherit, + target: nil + ) + + public subscript(key: K) -> V? { + get { + var value: V? + + queue.sync { + value = self.dictionary[key] + } + + return value + } + set { + queue.sync(flags: DispatchWorkItemFlags.barrier) { + self.dictionary[key] = newValue + } + } + } + } + +// Store manager to retain its reference +private var managerStore = SynchronizedDictionary() + +open class AlamofireRequestBuilder: RequestBuilder { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { + super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) + } + + /** + May be overridden by a subclass if you want to control the session + configuration. + */ + open func createSessionManager() -> Alamofire.SessionManager { + let configuration = URLSessionConfiguration.default + configuration.httpAdditionalHeaders = buildHeaders() + return Alamofire.SessionManager(configuration: configuration) + } + + /** + May be overridden by a subclass if you want to custom request constructor. + */ + open func createURLRequest() -> URLRequest? { + let encoding: ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding() + guard let originalRequest = try? URLRequest(url: URLString, method: HTTPMethod(rawValue: method)!, headers: buildHeaders()) else { return nil } + return try? encoding.encode(originalRequest, with: parameters) + } + + /** + May be overridden by a subclass if you want to control the Content-Type + that is given to an uploaded form part. + + Return nil to use the default behavior (inferring the Content-Type from + the file extension). Return the desired Content-Type otherwise. + */ + open func contentTypeForFormPart(fileURL: URL) -> String? { + return nil + } + + /** + May be overridden by a subclass if you want to control the request + configuration (e.g. to override the cache policy). + */ + open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) -> DataRequest { + return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers) + } + + override open func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + let managerId: String = UUID().uuidString + // Create a new manager for each request to customize its request header + let manager = createSessionManager() + managerStore[managerId] = manager + + let encoding: ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding() + + let xMethod = Alamofire.HTTPMethod(rawValue: method) + let fileKeys = parameters == nil ? [] : parameters!.filter { $1 is NSURL } + .map { $0.0 } + + if fileKeys.count > 0 { + manager.upload(multipartFormData: { mpForm in + for (k, v) in self.parameters! { + switch v { + case let fileURL as URL: + if let mimeType = self.contentTypeForFormPart(fileURL: fileURL) { + mpForm.append(fileURL, withName: k, fileName: fileURL.lastPathComponent, mimeType: mimeType) + } else { + mpForm.append(fileURL, withName: k) + } + case let string as String: + mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k) + case let number as NSNumber: + mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k) + default: + fatalError("Unprocessable value \(v) with key \(k)") + } + } + }, to: URLString, method: xMethod!, headers: nil, encodingCompletion: { encodingResult in + switch encodingResult { + case .success(let upload, _, _): + if let onProgressReady = self.onProgressReady { + onProgressReady(upload.uploadProgress) + } + self.processRequest(request: upload, managerId, completion) + case .failure(let encodingError): + completion(nil, ErrorResponse.error(415, nil, encodingError)) + } + }) + } else { + let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding, headers: headers) + if let onProgressReady = self.onProgressReady { + onProgressReady(request.progress) + } + processRequest(request: request, managerId, completion) + } + + } + + fileprivate func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + if let credential = self.credential { + request.authenticate(usingCredential: credential) + } + + let cleanupRequest = { + managerStore[managerId] = nil + } + + let validatedRequest = request.validate() + + switch T.self { + case is String.Type: + validatedRequest.responseString(completionHandler: { (stringResponse) in + cleanupRequest() + + if stringResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(stringResponse.response?.statusCode ?? 500, stringResponse.data, stringResponse.result.error!) + ) + return + } + + completion( + Response( + response: stringResponse.response!, + body: ((stringResponse.result.value ?? "") as! T) + ), + nil + ) + }) + case is URL.Type: + validatedRequest.responseData(completionHandler: { (dataResponse) in + cleanupRequest() + + do { + + guard !dataResponse.result.isFailure else { + throw DownloadException.responseFailed + } + + guard let data = dataResponse.data else { + throw DownloadException.responseDataMissing + } + + guard let request = request.request else { + throw DownloadException.requestMissing + } + + let fileManager = FileManager.default + let urlRequest = try request.asURLRequest() + let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] + let requestURL = try self.getURL(from: urlRequest) + + var requestPath = try self.getPath(from: requestURL) + + if let headerFileName = self.getFileName(fromContentDisposition: dataResponse.response?.allHeaderFields["Content-Disposition"] as? String) { + requestPath = requestPath.appending("/\(headerFileName)") + } + + let filePath = documentsDirectory.appendingPathComponent(requestPath) + let directoryPath = filePath.deletingLastPathComponent().path + + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) + try data.write(to: filePath, options: .atomic) + + completion( + Response( + response: dataResponse.response!, + body: (filePath as! T) + ), + nil + ) + + } catch let requestParserError as DownloadException { + completion(nil, ErrorResponse.error(400, dataResponse.data, requestParserError)) + } catch let error { + completion(nil, ErrorResponse.error(400, dataResponse.data, error)) + } + return + }) + case is Void.Type: + validatedRequest.responseData(completionHandler: { (voidResponse) in + cleanupRequest() + + if voidResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(voidResponse.response?.statusCode ?? 500, voidResponse.data, voidResponse.result.error!) + ) + return + } + + completion( + Response( + response: voidResponse.response!, + body: nil), + nil + ) + }) + default: + validatedRequest.responseData(completionHandler: { (dataResponse) in + cleanupRequest() + + if dataResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, dataResponse.result.error!) + ) + return + } + + completion( + Response( + response: dataResponse.response!, + body: (dataResponse.data as! T) + ), + nil + ) + }) + } + } + + open func buildHeaders() -> [String: String] { + var httpHeaders = SessionManager.defaultHTTPHeaders + for (key, value) in self.headers { + httpHeaders[key] = value + } + return httpHeaders + } + + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { + + guard let contentDisposition = contentDisposition else { + return nil + } + + let items = contentDisposition.components(separatedBy: ";") + + var filename: String? + + for contentItem in items { + + let filenameKey = "filename=" + guard let range = contentItem.range(of: filenameKey) else { + break + } + + filename = contentItem + return filename? + .replacingCharacters(in: range, with: "") + .replacingOccurrences(of: "\"", with: "") + .trimmingCharacters(in: .whitespacesAndNewlines) + } + + return filename + + } + + fileprivate func getPath(from url: URL) throws -> String { + + guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { + throw DownloadException.requestMissingPath + } + + if path.hasPrefix("/") { + path.remove(at: path.startIndex) + } + + return path + + } + + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { + + guard let url = urlRequest.url else { + throw DownloadException.requestMissingURL + } + + return url + } + +} + +private enum DownloadException: Error { + case responseDataMissing + case responseFailed + case requestMissing + case requestMissingPath + case requestMissingURL +} + +public enum AlamofireDecodableRequestBuilderError: Error { + case emptyDataResponse + case nilHTTPResponse + case jsonDecoding(DecodingError) + case generalError(Error) +} + +open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder { + + override fileprivate func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + if let credential = self.credential { + request.authenticate(usingCredential: credential) + } + + let cleanupRequest = { + managerStore[managerId] = nil + } + + let validatedRequest = request.validate() + + switch T.self { + case is String.Type: + validatedRequest.responseString(completionHandler: { (stringResponse) in + cleanupRequest() + + if stringResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(stringResponse.response?.statusCode ?? 500, stringResponse.data, stringResponse.result.error!) + ) + return + } + + completion( + Response( + response: stringResponse.response!, + body: ((stringResponse.result.value ?? "") as! T) + ), + nil + ) + }) + case is Void.Type: + validatedRequest.responseData(completionHandler: { (voidResponse) in + cleanupRequest() + + if voidResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(voidResponse.response?.statusCode ?? 500, voidResponse.data, voidResponse.result.error!) + ) + return + } + + completion( + Response( + response: voidResponse.response!, + body: nil), + nil + ) + }) + case is Data.Type: + validatedRequest.responseData(completionHandler: { (dataResponse) in + cleanupRequest() + + if dataResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, dataResponse.result.error!) + ) + return + } + + completion( + Response( + response: dataResponse.response!, + body: (dataResponse.data as! T) + ), + nil + ) + }) + default: + validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + cleanupRequest() + + guard dataResponse.result.isSuccess else { + completion(nil, ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, dataResponse.result.error!)) + return + } + + guard let data = dataResponse.data, !data.isEmpty else { + completion(nil, ErrorResponse.error(-1, nil, AlamofireDecodableRequestBuilderError.emptyDataResponse)) + return + } + + guard let httpResponse = dataResponse.response else { + completion(nil, ErrorResponse.error(-2, nil, AlamofireDecodableRequestBuilderError.nilHTTPResponse)) + return + } + + var responseObj: Response? + + let decodeResult: (decodableObj: T?, error: Error?) = CodableHelper.decode(T.self, from: data) + if decodeResult.error == nil { + responseObj = Response(response: httpResponse, body: decodeResult.decodableObj) + } + + completion(responseObj, decodeResult.error) + }) + } + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift new file mode 100644 index 00000000000..0a333db0d10 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -0,0 +1,71 @@ +// +// CodableHelper.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public typealias EncodeResult = (data: Data?, error: Error?) + +open class CodableHelper { + + public static var dateformatter: DateFormatter? + + open class func decode(_ type: T.Type, from data: Data) -> (decodableObj: T?, error: Error?) where T: Decodable { + var returnedDecodable: T? + var returnedError: Error? + + let decoder = JSONDecoder() + if let df = self.dateformatter { + decoder.dateDecodingStrategy = .formatted(df) + } else { + decoder.dataDecodingStrategy = .base64 + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = Configuration.dateFormat + decoder.dateDecodingStrategy = .formatted(formatter) + } + + do { + returnedDecodable = try decoder.decode(type, from: data) + } catch { + returnedError = error + } + + return (returnedDecodable, returnedError) + } + + open class func encode(_ value: T, prettyPrint: Bool = false) -> EncodeResult where T: Encodable { + var returnedData: Data? + var returnedError: Error? + + let encoder = JSONEncoder() + if prettyPrint { + encoder.outputFormatting = .prettyPrinted + } + if let df = self.dateformatter { + encoder.dateEncodingStrategy = .formatted(df) + } else { + encoder.dataEncodingStrategy = .base64 + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = Configuration.dateFormat + encoder.dateEncodingStrategy = .formatted(formatter) + } + + do { + returnedData = try encoder.encode(value) + } catch { + returnedError = error + } + + return (returnedData, returnedError) + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift new file mode 100644 index 00000000000..e1ecb39726e --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -0,0 +1,15 @@ +// Configuration.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class Configuration { + + // This value is used to configure the date formatter that is used to serialize dates into JSON format. + // You must set it prior to encoding any dates, and it will only be read once. + public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift new file mode 100644 index 00000000000..b223c143e0f --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -0,0 +1,176 @@ +// Extensions.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +extension Bool: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Float: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Int: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Int32: JSONEncodable { + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } +} + +extension Int64: JSONEncodable { + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } +} + +extension Double: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension String: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +private func encodeIfPossible(_ object: T) -> Any { + if let encodableObject = object as? JSONEncodable { + return encodableObject.encodeToJSON() + } else { + return object as Any + } +} + +extension Array: JSONEncodable { + func encodeToJSON() -> Any { + return self.map(encodeIfPossible) + } +} + +extension Dictionary: JSONEncodable { + func encodeToJSON() -> Any { + var dictionary = [AnyHashable: Any]() + for (key, value) in self { + dictionary[key] = encodeIfPossible(value) + } + return dictionary as Any + } +} + +extension Data: JSONEncodable { + func encodeToJSON() -> Any { + return self.base64EncodedString(options: Data.Base64EncodingOptions()) + } +} + +private let dateFormatter: DateFormatter = { + if let formatter = CodableHelper.dateformatter { + return formatter + } else { + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = Configuration.dateFormat + return formatter + } +}() + +extension Date: JSONEncodable { + func encodeToJSON() -> Any { + return dateFormatter.string(from: self) as Any + } +} + +extension UUID: JSONEncodable { + func encodeToJSON() -> Any { + return self.uuidString + } +} + +extension String: CodingKey { + + public var stringValue: String { + return self + } + + public init?(stringValue: String) { + self.init(stringLiteral: stringValue) + } + + public var intValue: Int? { + return nil + } + + public init?(intValue: Int) { + return nil + } + +} + +extension KeyedEncodingContainerProtocol { + + public mutating func encodeArray(_ values: [T], forKey key: Self.Key) throws where T: Encodable { + var arrayContainer = nestedUnkeyedContainer(forKey: key) + try arrayContainer.encode(contentsOf: values) + } + + public mutating func encodeArrayIfPresent(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { + if let values = values { + try encodeArray(values, forKey: key) + } + } + + public mutating func encodeMap(_ pairs: [Self.Key: T]) throws where T: Encodable { + for (key, value) in pairs { + try encode(value, forKey: key) + } + } + + public mutating func encodeMapIfPresent(_ pairs: [Self.Key: T]?) throws where T: Encodable { + if let pairs = pairs { + try encodeMap(pairs) + } + } + +} + +extension KeyedDecodingContainerProtocol { + + public func decodeArray(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { + var tmpArray = [T]() + + var nestedContainer = try nestedUnkeyedContainer(forKey: key) + while !nestedContainer.isAtEnd { + let arrayValue = try nestedContainer.decode(T.self) + tmpArray.append(arrayValue) + } + + return tmpArray + } + + public func decodeArrayIfPresent(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? + + if contains(key) { + tmpArray = try decodeArray(T.self, forKey: key) + } + + return tmpArray + } + + public func decodeMap(_ type: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] + + for key in allKeys { + if !excludedKeys.contains(key) { + let value = try decode(T.self, forKey: key) + map[key] = value + } + } + + return map + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift new file mode 100644 index 00000000000..fb76bbed26f --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift @@ -0,0 +1,54 @@ +// +// JSONDataEncoding.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation +import Alamofire + +public struct JSONDataEncoding: ParameterEncoding { + + // MARK: Properties + + private static let jsonDataKey = "jsonData" + + // MARK: Encoding + + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. This should have a single key/value + /// pair with "jsonData" as the key and a Data object as the value. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { + var urlRequest = try urlRequest.asURLRequest() + + guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else { + return urlRequest + } + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = jsonData + + return urlRequest + } + + public static func encodingParameters(jsonData: Data?) -> Parameters? { + var returnedParams: Parameters? + if let jsonData = jsonData, !jsonData.isEmpty { + var params = Parameters() + params[jsonDataKey] = jsonData + returnedParams = params + } + return returnedParams + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift new file mode 100644 index 00000000000..7bd1267e95f --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -0,0 +1,43 @@ +// +// JSONEncodingHelper.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation +import Alamofire + +open class JSONEncodingHelper { + + open class func encodingParameters(forEncodableObject encodableObj: T?) -> Parameters? { + var params: Parameters? + + // Encode the Encodable object + if let encodableObj = encodableObj { + let encodeResult = CodableHelper.encode(encodableObj, prettyPrint: true) + if encodeResult.error == nil { + params = JSONDataEncoding.encodingParameters(jsonData: encodeResult.data) + } + } + + return params + } + + open class func encodingParameters(forEncodableObject encodableObj: Any?) -> Parameters? { + var params: Parameters? + + if let encodableObj = encodableObj { + do { + let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) + params = JSONDataEncoding.encodingParameters(jsonData: data) + } catch { + print(error) + return nil + } + } + + return params + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift new file mode 100644 index 00000000000..25161165865 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -0,0 +1,36 @@ +// Models.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +protocol JSONEncodable { + func encodeToJSON() -> Any +} + +public enum ErrorResponse: Error { + case error(Int, Data?, Error) +} + +open class Response { + public let statusCode: Int + public let header: [String: String] + public let body: T? + + public init(statusCode: Int, header: [String: String], body: T?) { + self.statusCode = statusCode + self.header = header + self.body = body + } + + public convenience init(response: HTTPURLResponse, body: T?) { + let rawHeader = response.allHeaderFields + var header = [String: String]() + for case let (key, value) as (String, String) in rawHeader { + header[key] = value + } + self.init(statusCode: response.statusCode, header: header, body: body) + } +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift new file mode 100644 index 00000000000..83a06951ccd --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -0,0 +1,25 @@ +// +// AdditionalPropertiesClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct AdditionalPropertiesClass: Codable { + + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? + + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { + self.mapString = mapString + self.mapMapString = mapMapString + } + + public enum CodingKeys: String, CodingKey { + case mapString = "map_string" + case mapMapString = "map_map_string" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift new file mode 100644 index 00000000000..5ed9f31e2a3 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -0,0 +1,20 @@ +// +// Animal.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Animal: Codable { + + public var className: String + public var color: String? = "red" + + public init(className: String, color: String?) { + self.className = className + self.color = color + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift new file mode 100644 index 00000000000..e09b0e9efdc --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -0,0 +1,10 @@ +// +// AnimalFarm.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift new file mode 100644 index 00000000000..ec270da8907 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -0,0 +1,22 @@ +// +// ApiResponse.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ApiResponse: Codable { + + public var code: Int? + public var type: String? + public var message: String? + + public init(code: Int?, type: String?, message: String?) { + self.code = code + self.type = type + self.message = message + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift new file mode 100644 index 00000000000..3843287630b --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -0,0 +1,22 @@ +// +// ArrayOfArrayOfNumberOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ArrayOfArrayOfNumberOnly: Codable { + + public var arrayArrayNumber: [[Double]]? + + public init(arrayArrayNumber: [[Double]]?) { + self.arrayArrayNumber = arrayArrayNumber + } + + public enum CodingKeys: String, CodingKey { + case arrayArrayNumber = "ArrayArrayNumber" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift new file mode 100644 index 00000000000..f8b198e81f5 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -0,0 +1,22 @@ +// +// ArrayOfNumberOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ArrayOfNumberOnly: Codable { + + public var arrayNumber: [Double]? + + public init(arrayNumber: [Double]?) { + self.arrayNumber = arrayNumber + } + + public enum CodingKeys: String, CodingKey { + case arrayNumber = "ArrayNumber" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift new file mode 100644 index 00000000000..67f7f7e5151 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -0,0 +1,28 @@ +// +// ArrayTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ArrayTest: Codable { + + public var arrayOfString: [String]? + public var arrayArrayOfInteger: [[Int64]]? + public var arrayArrayOfModel: [[ReadOnlyFirst]]? + + public init(arrayOfString: [String]?, arrayArrayOfInteger: [[Int64]]?, arrayArrayOfModel: [[ReadOnlyFirst]]?) { + self.arrayOfString = arrayOfString + self.arrayArrayOfInteger = arrayArrayOfInteger + self.arrayArrayOfModel = arrayArrayOfModel + } + + public enum CodingKeys: String, CodingKey { + case arrayOfString = "array_of_string" + case arrayArrayOfInteger = "array_array_of_integer" + case arrayArrayOfModel = "array_array_of_model" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift new file mode 100644 index 00000000000..d576b50b1c9 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -0,0 +1,38 @@ +// +// Capitalization.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Capitalization: Codable { + + public var smallCamel: String? + public var capitalCamel: String? + public var smallSnake: String? + public var capitalSnake: String? + public var sCAETHFlowPoints: String? + /** Name of the pet */ + public var ATT_NAME: String? + + public init(smallCamel: String?, capitalCamel: String?, smallSnake: String?, capitalSnake: String?, sCAETHFlowPoints: String?, ATT_NAME: String?) { + self.smallCamel = smallCamel + self.capitalCamel = capitalCamel + self.smallSnake = smallSnake + self.capitalSnake = capitalSnake + self.sCAETHFlowPoints = sCAETHFlowPoints + self.ATT_NAME = ATT_NAME + } + + public enum CodingKeys: String, CodingKey { + case smallCamel + case capitalCamel = "CapitalCamel" + case smallSnake = "small_Snake" + case capitalSnake = "Capital_Snake" + case sCAETHFlowPoints = "SCA_ETH_Flow_Points" + case ATT_NAME + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift new file mode 100644 index 00000000000..7ab887f3113 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -0,0 +1,22 @@ +// +// Cat.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Cat: Codable { + + public var className: String + public var color: String? = "red" + public var declawed: Bool? + + public init(className: String, color: String?, declawed: Bool?) { + self.className = className + self.color = color + self.declawed = declawed + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift new file mode 100644 index 00000000000..a51ad0dffab --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -0,0 +1,18 @@ +// +// CatAllOf.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct CatAllOf: Codable { + + public var declawed: Bool? + + public init(declawed: Bool?) { + self.declawed = declawed + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift new file mode 100644 index 00000000000..eb8f7e5e197 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -0,0 +1,20 @@ +// +// Category.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Category: Codable { + + public var id: Int64? + public var name: String = "default-name" + + public init(id: Int64?, name: String) { + self.id = id + self.name = name + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift new file mode 100644 index 00000000000..28cb30ce7b4 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -0,0 +1,20 @@ +// +// ClassModel.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing model with \"_class\" property */ + +public struct ClassModel: Codable { + + public var _class: String? + + public init(_class: String?) { + self._class = _class + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift new file mode 100644 index 00000000000..00245ca3728 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -0,0 +1,18 @@ +// +// Client.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Client: Codable { + + public var client: String? + + public init(client: String?) { + self.client = client + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift new file mode 100644 index 00000000000..492c1228008 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -0,0 +1,22 @@ +// +// Dog.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Dog: Codable { + + public var className: String + public var color: String? = "red" + public var breed: String? + + public init(className: String, color: String?, breed: String?) { + self.className = className + self.color = color + self.breed = breed + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift new file mode 100644 index 00000000000..7786f8acc5a --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -0,0 +1,18 @@ +// +// DogAllOf.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct DogAllOf: Codable { + + public var breed: String? + + public init(breed: String?) { + self.breed = breed + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift new file mode 100644 index 00000000000..5034ff0b8c6 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -0,0 +1,33 @@ +// +// EnumArrays.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct EnumArrays: Codable { + + public enum JustSymbol: String, Codable { + case greaterThanOrEqualTo = ">=" + case dollar = "$" + } + public enum ArrayEnum: String, Codable { + case fish = "fish" + case crab = "crab" + } + public var justSymbol: JustSymbol? + public var arrayEnum: [ArrayEnum]? + + public init(justSymbol: JustSymbol?, arrayEnum: [ArrayEnum]?) { + self.justSymbol = justSymbol + self.arrayEnum = arrayEnum + } + + public enum CodingKeys: String, CodingKey { + case justSymbol = "just_symbol" + case arrayEnum = "array_enum" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift new file mode 100644 index 00000000000..3c1dfcac577 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -0,0 +1,14 @@ +// +// EnumClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public enum EnumClass: String, Codable { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift new file mode 100644 index 00000000000..6db9b34d183 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -0,0 +1,52 @@ +// +// EnumTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct EnumTest: Codable { + + public enum EnumString: String, Codable { + case upper = "UPPER" + case lower = "lower" + case empty = "" + } + public enum EnumStringRequired: String, Codable { + case upper = "UPPER" + case lower = "lower" + case empty = "" + } + public enum EnumInteger: Int, Codable { + case _1 = 1 + case number1 = -1 + } + public enum EnumNumber: Double, Codable { + case _11 = 1.1 + case number12 = -1.2 + } + public var enumString: EnumString? + public var enumStringRequired: EnumStringRequired + public var enumInteger: EnumInteger? + public var enumNumber: EnumNumber? + public var outerEnum: OuterEnum? + + public init(enumString: EnumString?, enumStringRequired: EnumStringRequired, enumInteger: EnumInteger?, enumNumber: EnumNumber?, outerEnum: OuterEnum?) { + self.enumString = enumString + self.enumStringRequired = enumStringRequired + self.enumInteger = enumInteger + self.enumNumber = enumNumber + self.outerEnum = outerEnum + } + + public enum CodingKeys: String, CodingKey { + case enumString = "enum_string" + case enumStringRequired = "enum_string_required" + case enumInteger = "enum_integer" + case enumNumber = "enum_number" + case outerEnum + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift new file mode 100644 index 00000000000..ea3520f053d --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -0,0 +1,21 @@ +// +// File.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Must be named `File` for test. */ + +public struct File: Codable { + + /** Test capitalization */ + public var sourceURI: String? + + public init(sourceURI: String?) { + self.sourceURI = sourceURI + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift new file mode 100644 index 00000000000..532f1457939 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -0,0 +1,20 @@ +// +// FileSchemaTestClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct FileSchemaTestClass: Codable { + + public var file: File? + public var files: [File]? + + public init(file: File?, files: [File]?) { + self.file = file + self.files = files + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift new file mode 100644 index 00000000000..20bd6d103b3 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -0,0 +1,42 @@ +// +// FormatTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct FormatTest: Codable { + + public var integer: Int? + public var int32: Int? + public var int64: Int64? + public var number: Double + public var float: Float? + public var double: Double? + public var string: String? + public var byte: Data + public var binary: URL? + public var date: Date + public var dateTime: Date? + public var uuid: UUID? + public var password: String + + public init(integer: Int?, int32: Int?, int64: Int64?, number: Double, float: Float?, double: Double?, string: String?, byte: Data, binary: URL?, date: Date, dateTime: Date?, uuid: UUID?, password: String) { + self.integer = integer + self.int32 = int32 + self.int64 = int64 + self.number = number + self.float = float + self.double = double + self.string = string + self.byte = byte + self.binary = binary + self.date = date + self.dateTime = dateTime + self.uuid = uuid + self.password = password + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift new file mode 100644 index 00000000000..906ddb06fb1 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -0,0 +1,20 @@ +// +// HasOnlyReadOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct HasOnlyReadOnly: Codable { + + public var bar: String? + public var foo: String? + + public init(bar: String?, foo: String?) { + self.bar = bar + self.foo = foo + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift new file mode 100644 index 00000000000..08d59953873 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -0,0 +1,22 @@ +// +// List.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct List: Codable { + + public var _123list: String? + + public init(_123list: String?) { + self._123list = _123list + } + + public enum CodingKeys: String, CodingKey { + case _123list = "123-list" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift new file mode 100644 index 00000000000..3a10a7dfcaf --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -0,0 +1,35 @@ +// +// MapTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct MapTest: Codable { + + public enum MapOfEnumString: String, Codable { + case upper = "UPPER" + case lower = "lower" + } + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? + public var indirectMap: StringBooleanMap? + + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { + self.mapMapOfString = mapMapOfString + self.mapOfEnumString = mapOfEnumString + self.directMap = directMap + self.indirectMap = indirectMap + } + + public enum CodingKeys: String, CodingKey { + case mapMapOfString = "map_map_of_string" + case mapOfEnumString = "map_of_enum_string" + case directMap = "direct_map" + case indirectMap = "indirect_map" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift new file mode 100644 index 00000000000..c3deb2f2893 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -0,0 +1,22 @@ +// +// MixedPropertiesAndAdditionalPropertiesClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { + + public var uuid: UUID? + public var dateTime: Date? + public var map: [String: Animal]? + + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { + self.uuid = uuid + self.dateTime = dateTime + self.map = map + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift new file mode 100644 index 00000000000..7ed6aad907b --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -0,0 +1,27 @@ +// +// Model200Response.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing model name starting with number */ + +public struct Model200Response: Codable { + + public var name: Int? + public var _class: String? + + public init(name: Int?, _class: String?) { + self.name = name + self._class = _class + } + + public enum CodingKeys: String, CodingKey { + case name + case _class = "class" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift new file mode 100644 index 00000000000..ce9ffe4fb38 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -0,0 +1,33 @@ +// +// Name.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing model name same as property name */ + +public struct Name: Codable { + + public var name: Int + public var snakeCase: Int? + public var property: String? + public var _123number: Int? + + public init(name: Int, snakeCase: Int?, property: String?, _123number: Int?) { + self.name = name + self.snakeCase = snakeCase + self.property = property + self._123number = _123number + } + + public enum CodingKeys: String, CodingKey { + case name + case snakeCase = "snake_case" + case property + case _123number = "123Number" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift new file mode 100644 index 00000000000..abd2269e8e7 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -0,0 +1,22 @@ +// +// NumberOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct NumberOnly: Codable { + + public var justNumber: Double? + + public init(justNumber: Double?) { + self.justNumber = justNumber + } + + public enum CodingKeys: String, CodingKey { + case justNumber = "JustNumber" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift new file mode 100644 index 00000000000..a6e1b1d2e5e --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -0,0 +1,34 @@ +// +// Order.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Order: Codable { + + public enum Status: String, Codable { + case placed = "placed" + case approved = "approved" + case delivered = "delivered" + } + public var id: Int64? + public var petId: Int64? + public var quantity: Int? + public var shipDate: Date? + /** Order Status */ + public var status: Status? + public var complete: Bool? = false + + public init(id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) { + self.id = id + self.petId = petId + self.quantity = quantity + self.shipDate = shipDate + self.status = status + self.complete = complete + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift new file mode 100644 index 00000000000..49aec001c5d --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -0,0 +1,28 @@ +// +// OuterComposite.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct OuterComposite: Codable { + + public var myNumber: Double? + public var myString: String? + public var myBoolean: Bool? + + public init(myNumber: Double?, myString: String?, myBoolean: Bool?) { + self.myNumber = myNumber + self.myString = myString + self.myBoolean = myBoolean + } + + public enum CodingKeys: String, CodingKey { + case myNumber = "my_number" + case myString = "my_string" + case myBoolean = "my_boolean" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift new file mode 100644 index 00000000000..9f80fc95ecf --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -0,0 +1,14 @@ +// +// OuterEnum.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public enum OuterEnum: String, Codable { + case placed = "placed" + case approved = "approved" + case delivered = "delivered" +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift new file mode 100644 index 00000000000..af60a550bb1 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -0,0 +1,34 @@ +// +// Pet.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Pet: Codable { + + public enum Status: String, Codable { + case available = "available" + case pending = "pending" + case sold = "sold" + } + public var id: Int64? + public var category: Category? + public var name: String + public var photoUrls: [String] + public var tags: [Tag]? + /** pet status in the store */ + public var status: Status? + + public init(id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) { + self.id = id + self.category = category + self.name = name + self.photoUrls = photoUrls + self.tags = tags + self.status = status + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift new file mode 100644 index 00000000000..0acd21fd100 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -0,0 +1,20 @@ +// +// ReadOnlyFirst.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ReadOnlyFirst: Codable { + + public var bar: String? + public var baz: String? + + public init(bar: String?, baz: String?) { + self.bar = bar + self.baz = baz + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift new file mode 100644 index 00000000000..076082af842 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -0,0 +1,24 @@ +// +// Return.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing reserved words */ + +public struct Return: Codable { + + public var _return: Int? + + public init(_return: Int?) { + self._return = _return + } + + public enum CodingKeys: String, CodingKey { + case _return = "return" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift new file mode 100644 index 00000000000..e79fc45c0e9 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -0,0 +1,22 @@ +// +// SpecialModelName.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct SpecialModelName: Codable { + + public var specialPropertyName: Int64? + + public init(specialPropertyName: Int64?) { + self.specialPropertyName = specialPropertyName + } + + public enum CodingKeys: String, CodingKey { + case specialPropertyName = "$special[property.name]" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift new file mode 100644 index 00000000000..3f1237fee47 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -0,0 +1,45 @@ +// +// StringBooleanMap.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct StringBooleanMap: Codable { + + public var additionalProperties: [String: Bool] = [:] + + public subscript(key: String) -> Bool? { + get { + if let value = additionalProperties[key] { + return value + } + return nil + } + + set { + additionalProperties[key] = newValue + } + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeMap(additionalProperties) + } + + // Decodable protocol methods + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + var nonAdditionalPropertyKeys = Set() + additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift new file mode 100644 index 00000000000..4dd8a9a9f5a --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -0,0 +1,20 @@ +// +// Tag.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Tag: Codable { + + public var id: Int64? + public var name: String? + + public init(id: Int64?, name: String?) { + self.id = id + self.name = name + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift new file mode 100644 index 00000000000..bf0006e1a26 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -0,0 +1,34 @@ +// +// TypeHolderDefault.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct TypeHolderDefault: Codable { + + public var stringItem: String = "what" + public var numberItem: Double + public var integerItem: Int + public var boolItem: Bool = true + public var arrayItem: [Int] + + public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) { + self.stringItem = stringItem + self.numberItem = numberItem + self.integerItem = integerItem + self.boolItem = boolItem + self.arrayItem = arrayItem + } + + public enum CodingKeys: String, CodingKey { + case stringItem = "string_item" + case numberItem = "number_item" + case integerItem = "integer_item" + case boolItem = "bool_item" + case arrayItem = "array_item" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift new file mode 100644 index 00000000000..602a2a6d185 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -0,0 +1,34 @@ +// +// TypeHolderExample.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct TypeHolderExample: Codable { + + public var stringItem: String + public var numberItem: Double + public var integerItem: Int + public var boolItem: Bool + public var arrayItem: [Int] + + public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) { + self.stringItem = stringItem + self.numberItem = numberItem + self.integerItem = integerItem + self.boolItem = boolItem + self.arrayItem = arrayItem + } + + public enum CodingKeys: String, CodingKey { + case stringItem = "string_item" + case numberItem = "number_item" + case integerItem = "integer_item" + case boolItem = "bool_item" + case arrayItem = "array_item" + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift new file mode 100644 index 00000000000..79f271ed735 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -0,0 +1,33 @@ +// +// User.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct User: Codable { + + public var id: Int64? + public var username: String? + public var firstName: String? + public var lastName: String? + public var email: String? + public var password: String? + public var phone: String? + /** User Status */ + public var userStatus: Int? + + public init(id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) { + self.id = id + self.username = username + self.firstName = firstName + self.lastName = lastName + self.email = email + self.password = password + self.phone = phone + self.userStatus = userStatus + } + +} diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Result.swift b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Result.swift new file mode 100644 index 00000000000..06477859ae1 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient/Classes/OpenAPIs/Result.swift @@ -0,0 +1,17 @@ +// +// Result.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +#if swift(<5) + +public enum Result { + case success(Value) + case failure(Error) +} + +#endif diff --git a/samples/client/petstore/swift4/resultLibrary/README.md b/samples/client/petstore/swift4/resultLibrary/README.md new file mode 100644 index 00000000000..0711eb87054 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/README.md @@ -0,0 +1,141 @@ +# Swift4 API client for PetstoreClient + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: +- Build package: org.openapitools.codegen.languages.Swift4Codegen + +## Installation + +### Carthage + +Run `carthage update` + +### CocoaPods + +Run `pod install` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeAPI* | [**call123testSpecialTags**](docs/AnotherFakeAPI.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*FakeAPI* | [**fakeOuterBooleanSerialize**](docs/FakeAPI.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeAPI* | [**fakeOuterCompositeSerialize**](docs/FakeAPI.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeAPI* | [**fakeOuterNumberSerialize**](docs/FakeAPI.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeAPI* | [**fakeOuterStringSerialize**](docs/FakeAPI.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeAPI* | [**testBodyWithFileSchema**](docs/FakeAPI.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +*FakeAPI* | [**testBodyWithQueryParams**](docs/FakeAPI.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +*FakeAPI* | [**testClientModel**](docs/FakeAPI.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +*FakeAPI* | [**testEndpointParameters**](docs/FakeAPI.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeAPI* | [**testEnumParameters**](docs/FakeAPI.md#testenumparameters) | **GET** /fake | To test enum parameters +*FakeAPI* | [**testGroupParameters**](docs/FakeAPI.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeAPI* | [**testInlineAdditionalProperties**](docs/FakeAPI.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeAPI* | [**testJsonFormData**](docs/FakeAPI.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeClassnameTags123API* | [**testClassname**](docs/FakeClassnameTags123API.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetAPI* | [**addPet**](docs/PetAPI.md#addpet) | **POST** /pet | Add a new pet to the store +*PetAPI* | [**deletePet**](docs/PetAPI.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet +*PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetAPI* | [**uploadFileWithRequiredFile**](docs/PetAPI.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreAPI* | [**deleteOrder**](docs/StoreAPI.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreAPI* | [**getInventory**](docs/StoreAPI.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreAPI* | [**getOrderById**](docs/StoreAPI.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreAPI* | [**placeOrder**](docs/StoreAPI.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserAPI* | [**createUser**](docs/UserAPI.md#createuser) | **POST** /user | Create user +*UserAPI* | [**createUsersWithArrayInput**](docs/UserAPI.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserAPI* | [**createUsersWithListInput**](docs/UserAPI.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserAPI* | [**deleteUser**](docs/UserAPI.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserAPI* | [**getUserByName**](docs/UserAPI.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserAPI* | [**loginUser**](docs/UserAPI.md#loginuser) | **GET** /user/login | Logs user into the system +*UserAPI* | [**logoutUser**](docs/UserAPI.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserAPI* | [**updateUser**](docs/UserAPI.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [Animal](docs/Animal.md) + - [AnimalFarm](docs/AnimalFarm.md) + - [ApiResponse](docs/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [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) + - [File](docs/File.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [List](docs/List.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Return](docs/Return.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [StringBooleanMap](docs/StringBooleanMap.md) + - [Tag](docs/Tag.md) + - [TypeHolderDefault](docs/TypeHolderDefault.md) + - [TypeHolderExample](docs/TypeHolderExample.md) + - [User](docs/User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +## http_basic_test + +- **Type**: HTTP basic authentication + +## 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 + + +## Author + + + diff --git a/samples/client/petstore/swift4/resultLibrary/docs/AdditionalPropertiesClass.md b/samples/client/petstore/swift4/resultLibrary/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..e22d28be1de --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/AdditionalPropertiesClass.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapString** | **[String:String]** | | [optional] +**mapMapString** | [String:[String: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/swift4/resultLibrary/docs/Animal.md b/samples/client/petstore/swift4/resultLibrary/docs/Animal.md new file mode 100644 index 00000000000..69c601455cd --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Animal.md @@ -0,0 +1,11 @@ +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to "red"] + +[[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/swift4/resultLibrary/docs/AnimalFarm.md b/samples/client/petstore/swift4/resultLibrary/docs/AnimalFarm.md new file mode 100644 index 00000000000..df6bab21dae --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/AnimalFarm.md @@ -0,0 +1,9 @@ +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/swift4/resultLibrary/docs/AnotherFakeAPI.md b/samples/client/petstore/swift4/resultLibrary/docs/AnotherFakeAPI.md new file mode 100644 index 00000000000..aead5f1f980 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/AnotherFakeAPI.md @@ -0,0 +1,59 @@ +# AnotherFakeAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeAPI.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call123testSpecialTags** +```swift + open class func call123testSpecialTags(body: Client, completion: @escaping (_ data: Client?, _ error: Error?) -> Void) +``` + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Client(client: "client_example") // Client | client model + +// To test special tags +AnotherFakeAPI.call123testSpecialTags(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### 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/swift4/resultLibrary/docs/ApiResponse.md b/samples/client/petstore/swift4/resultLibrary/docs/ApiResponse.md new file mode 100644 index 00000000000..c6d9768fe9b --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Int** | | [optional] +**type** | **String** | | [optional] +**message** | **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/swift4/resultLibrary/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/swift4/resultLibrary/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..c6fceff5e08 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [[Double]] | | [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/swift4/resultLibrary/docs/ArrayOfNumberOnly.md b/samples/client/petstore/swift4/resultLibrary/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..f09f8fa6f70 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **[Double]** | | [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/swift4/resultLibrary/docs/ArrayTest.md b/samples/client/petstore/swift4/resultLibrary/docs/ArrayTest.md new file mode 100644 index 00000000000..bf416b8330c --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/ArrayTest.md @@ -0,0 +1,12 @@ +# ArrayTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **[String]** | | [optional] +**arrayArrayOfInteger** | [[Int64]] | | [optional] +**arrayArrayOfModel** | [[ReadOnlyFirst]] | | [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/swift4/resultLibrary/docs/Capitalization.md b/samples/client/petstore/swift4/resultLibrary/docs/Capitalization.md new file mode 100644 index 00000000000..95374216c77 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Capitalization.md @@ -0,0 +1,15 @@ +# Capitalization + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**sCAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [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/swift4/resultLibrary/docs/Cat.md b/samples/client/petstore/swift4/resultLibrary/docs/Cat.md new file mode 100644 index 00000000000..fb5949b1576 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Cat.md @@ -0,0 +1,10 @@ +# Cat + +## 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/swift4/resultLibrary/docs/CatAllOf.md b/samples/client/petstore/swift4/resultLibrary/docs/CatAllOf.md new file mode 100644 index 00000000000..79789be61c0 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/CatAllOf.md @@ -0,0 +1,10 @@ +# 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/swift4/resultLibrary/docs/Category.md b/samples/client/petstore/swift4/resultLibrary/docs/Category.md new file mode 100644 index 00000000000..5ca5408c0f9 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Category.md @@ -0,0 +1,11 @@ +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**name** | **String** | | [default to "default-name"] + +[[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/swift4/resultLibrary/docs/ClassModel.md b/samples/client/petstore/swift4/resultLibrary/docs/ClassModel.md new file mode 100644 index 00000000000..e3912fdf0fd --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/ClassModel.md @@ -0,0 +1,10 @@ +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_class** | **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/swift4/resultLibrary/docs/Client.md b/samples/client/petstore/swift4/resultLibrary/docs/Client.md new file mode 100644 index 00000000000..0de1b238c36 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Client.md @@ -0,0 +1,10 @@ +# Client + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **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/swift4/resultLibrary/docs/Dog.md b/samples/client/petstore/swift4/resultLibrary/docs/Dog.md new file mode 100644 index 00000000000..4824786da04 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Dog.md @@ -0,0 +1,10 @@ +# Dog + +## 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/swift4/resultLibrary/docs/DogAllOf.md b/samples/client/petstore/swift4/resultLibrary/docs/DogAllOf.md new file mode 100644 index 00000000000..9302ef52e93 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/DogAllOf.md @@ -0,0 +1,10 @@ +# 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/swift4/resultLibrary/docs/EnumArrays.md b/samples/client/petstore/swift4/resultLibrary/docs/EnumArrays.md new file mode 100644 index 00000000000..b9a9807d3c8 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/EnumArrays.md @@ -0,0 +1,11 @@ +# EnumArrays + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **[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/swift4/resultLibrary/docs/EnumClass.md b/samples/client/petstore/swift4/resultLibrary/docs/EnumClass.md new file mode 100644 index 00000000000..67f017becd0 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/EnumClass.md @@ -0,0 +1,9 @@ +# EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/swift4/resultLibrary/docs/EnumTest.md b/samples/client/petstore/swift4/resultLibrary/docs/EnumTest.md new file mode 100644 index 00000000000..bc9b036dd76 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/EnumTest.md @@ -0,0 +1,14 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] +**enumStringRequired** | **String** | | +**enumInteger** | **Int** | | [optional] +**enumNumber** | **Double** | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.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/swift4/resultLibrary/docs/FakeAPI.md b/samples/client/petstore/swift4/resultLibrary/docs/FakeAPI.md new file mode 100644 index 00000000000..49d4d3fb6a1 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/FakeAPI.md @@ -0,0 +1,662 @@ +# FakeAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeAPI.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeAPI.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeAPI.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeAPI.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**testBodyWithFileSchema**](FakeAPI.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeAPI.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeAPI.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeAPI.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeAPI.md#testenumparameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeAPI.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeAPI.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeAPI.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data + + +# **fakeOuterBooleanSerialize** +```swift + open class func fakeOuterBooleanSerialize(body: Bool? = nil, completion: @escaping (_ data: Bool?, _ error: Error?) -> Void) +``` + + + +Test serialization of outer boolean types + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = false // Bool | Input boolean as post body (optional) + +FakeAPI.fakeOuterBooleanSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Bool** | Input boolean as post body | [optional] + +### Return type + +**Bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **fakeOuterCompositeSerialize** +```swift + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping (_ data: OuterComposite?, _ error: Error?) -> Void) +``` + + + +Test serialization of object with outer number type + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = OuterComposite(myNumber: 123, myString: "myString_example", myBoolean: false) // OuterComposite | Input composite as post body (optional) + +FakeAPI.fakeOuterCompositeSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md) | Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **fakeOuterNumberSerialize** +```swift + open class func fakeOuterNumberSerialize(body: Double? = nil, completion: @escaping (_ data: Double?, _ error: Error?) -> Void) +``` + + + +Test serialization of outer number types + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = 987 // Double | Input number as post body (optional) + +FakeAPI.fakeOuterNumberSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Double** | Input number as post body | [optional] + +### Return type + +**Double** + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **fakeOuterStringSerialize** +```swift + open class func fakeOuterStringSerialize(body: String? = nil, completion: @escaping (_ data: String?, _ error: Error?) -> Void) +``` + + + +Test serialization of outer string types + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = "body_example" // String | Input string as post body (optional) + +FakeAPI.fakeOuterStringSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String** | Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testBodyWithFileSchema** +```swift + open class func testBodyWithFileSchema(body: FileSchemaTestClass, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = FileSchemaTestClass(file: File(sourceURI: "sourceURI_example"), files: [File(sourceURI: "sourceURI_example")]) // FileSchemaTestClass | + +FakeAPI.testBodyWithFileSchema(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testBodyWithQueryParams** +```swift + open class func testBodyWithQueryParams(query: String, body: User, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + + + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let query = "query_example" // String | +let body = User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123) // User | + +FakeAPI.testBodyWithQueryParams(query: query, body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String** | | + **body** | [**User**](User.md) | | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testClientModel** +```swift + open class func testClientModel(body: Client, completion: @escaping (_ data: Client?, _ error: Error?) -> Void) +``` + +To test \"client\" model + +To test \"client\" model + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Client(client: "client_example") // Client | client model + +// To test \"client\" model +FakeAPI.testClientModel(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### 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) + +# **testEndpointParameters** +```swift + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let number = 987 // Double | None +let double = 987 // Double | None +let patternWithoutDelimiter = "patternWithoutDelimiter_example" // String | None +let byte = 987 // Data | None +let integer = 987 // Int | None (optional) +let int32 = 987 // Int | None (optional) +let int64 = 987 // Int64 | None (optional) +let float = 987 // Float | None (optional) +let string = "string_example" // String | None (optional) +let binary = URL(string: "https://example.com")! // URL | None (optional) +let date = Date() // Date | None (optional) +let dateTime = Date() // Date | None (optional) +let password = "password_example" // String | None (optional) +let callback = "callback_example" // String | None (optional) + +// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +FakeAPI.testEndpointParameters(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **Double** | None | + **double** | **Double** | None | + **patternWithoutDelimiter** | **String** | None | + **byte** | **Data** | None | + **integer** | **Int** | None | [optional] + **int32** | **Int** | None | [optional] + **int64** | **Int64** | None | [optional] + **float** | **Float** | None | [optional] + **string** | **String** | None | [optional] + **binary** | **URL** | None | [optional] + **date** | **Date** | None | [optional] + **dateTime** | **Date** | None | [optional] + **password** | **String** | None | [optional] + **callback** | **String** | None | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **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) + +# **testEnumParameters** +```swift + open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +To test enum parameters + +To test enum parameters + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let enumHeaderStringArray = ["enumHeaderStringArray_example"] // [String] | Header parameter enum test (string array) (optional) +let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .efg) +let enumQueryStringArray = ["enumQueryStringArray_example"] // [String] | Query parameter enum test (string array) (optional) +let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .efg) +let enumQueryInteger = 987 // Int | Query parameter enum test (double) (optional) +let enumQueryDouble = 987 // Double | Query parameter enum test (double) (optional) +let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .dollar) +let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .efg) + +// To test enum parameters +FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**[String]**](String.md) | Header parameter enum test (string array) | [optional] + **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .efg] + **enumQueryStringArray** | [**[String]**](String.md) | Query parameter enum test (string array) | [optional] + **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .efg] + **enumQueryInteger** | **Int** | Query parameter enum test (double) | [optional] + **enumQueryDouble** | **Double** | Query parameter enum test (double) | [optional] + **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .dollar] + **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .efg] + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testGroupParameters** +```swift + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let requiredStringGroup = 987 // Int | Required String in group parameters +let requiredBooleanGroup = false // Bool | Required Boolean in group parameters +let requiredInt64Group = 987 // Int64 | Required Integer in group parameters +let stringGroup = 987 // Int | String in group parameters (optional) +let booleanGroup = false // Bool | Boolean in group parameters (optional) +let int64Group = 987 // Int64 | Integer in group parameters (optional) + +// Fake endpoint to test group parameters (optional) +FakeAPI.testGroupParameters(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **Int** | Required String in group parameters | + **requiredBooleanGroup** | **Bool** | Required Boolean in group parameters | + **requiredInt64Group** | **Int64** | Required Integer in group parameters | + **stringGroup** | **Int** | String in group parameters | [optional] + **booleanGroup** | **Bool** | Boolean in group parameters | [optional] + **int64Group** | **Int64** | Integer in group parameters | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testInlineAdditionalProperties** +```swift + open class func testInlineAdditionalProperties(param: [String:String], completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +test inline additionalProperties + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let param = "TODO" // [String:String] | request body + +// test inline additionalProperties +FakeAPI.testInlineAdditionalProperties(param: param) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | [**[String:String]**](String.md) | request body | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testJsonFormData** +```swift + open class func testJsonFormData(param: String, param2: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +test json serialization of form data + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let param = "param_example" // String | field1 +let param2 = "param2_example" // String | field2 + +// test json serialization of form data +FakeAPI.testJsonFormData(param: param, param2: param2) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String** | field1 | + **param2** | **String** | field2 | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + diff --git a/samples/client/petstore/swift4/resultLibrary/docs/FakeClassnameTags123API.md b/samples/client/petstore/swift4/resultLibrary/docs/FakeClassnameTags123API.md new file mode 100644 index 00000000000..9f24b46edbc --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/FakeClassnameTags123API.md @@ -0,0 +1,59 @@ +# FakeClassnameTags123API + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123API.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +```swift + open class func testClassname(body: Client, completion: @escaping (_ data: Client?, _ error: Error?) -> Void) +``` + +To test class name in snake case + +To test class name in snake case + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Client(client: "client_example") // Client | client model + +// To test class name in snake case +FakeClassnameTags123API.testClassname(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### 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/swift4/resultLibrary/docs/File.md b/samples/client/petstore/swift4/resultLibrary/docs/File.md new file mode 100644 index 00000000000..3edfef17b79 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/File.md @@ -0,0 +1,10 @@ +# File + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [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/swift4/resultLibrary/docs/FileSchemaTestClass.md b/samples/client/petstore/swift4/resultLibrary/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..afdacc60b2c --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# FileSchemaTestClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**File**](File.md) | | [optional] +**files** | [File] | | [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/swift4/resultLibrary/docs/FormatTest.md b/samples/client/petstore/swift4/resultLibrary/docs/FormatTest.md new file mode 100644 index 00000000000..f74d94f6c46 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/FormatTest.md @@ -0,0 +1,22 @@ +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Int** | | [optional] +**int32** | **Int** | | [optional] +**int64** | **Int64** | | [optional] +**number** | **Double** | | +**float** | **Float** | | [optional] +**double** | **Double** | | [optional] +**string** | **String** | | [optional] +**byte** | **Data** | | +**binary** | **URL** | | [optional] +**date** | **Date** | | +**dateTime** | **Date** | | [optional] +**uuid** | **UUID** | | [optional] +**password** | **String** | | + +[[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/swift4/resultLibrary/docs/HasOnlyReadOnly.md b/samples/client/petstore/swift4/resultLibrary/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..57b6e3a17e6 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# HasOnlyReadOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**foo** | **String** | | [optional] [readonly] + +[[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/swift4/resultLibrary/docs/List.md b/samples/client/petstore/swift4/resultLibrary/docs/List.md new file mode 100644 index 00000000000..b77718302ed --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/List.md @@ -0,0 +1,10 @@ +# List + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_123list** | **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/swift4/resultLibrary/docs/MapTest.md b/samples/client/petstore/swift4/resultLibrary/docs/MapTest.md new file mode 100644 index 00000000000..56213c4113f --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/MapTest.md @@ -0,0 +1,13 @@ +# MapTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [String:[String:String]] | | [optional] +**mapOfEnumString** | **[String:String]** | | [optional] +**directMap** | **[String:Bool]** | | [optional] +**indirectMap** | [**StringBooleanMap**](StringBooleanMap.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/swift4/resultLibrary/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/swift4/resultLibrary/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..fcffb8ecdbf --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,12 @@ +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **UUID** | | [optional] +**dateTime** | **Date** | | [optional] +**map** | [String:Animal] | | [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/swift4/resultLibrary/docs/Model200Response.md b/samples/client/petstore/swift4/resultLibrary/docs/Model200Response.md new file mode 100644 index 00000000000..5865ea690cc --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Model200Response.md @@ -0,0 +1,11 @@ +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Int** | | [optional] +**_class** | **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/swift4/resultLibrary/docs/Name.md b/samples/client/petstore/swift4/resultLibrary/docs/Name.md new file mode 100644 index 00000000000..f7b180292cd --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Name.md @@ -0,0 +1,13 @@ +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Int** | | +**snakeCase** | **Int** | | [optional] [readonly] +**property** | **String** | | [optional] +**_123number** | **Int** | | [optional] [readonly] + +[[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/swift4/resultLibrary/docs/NumberOnly.md b/samples/client/petstore/swift4/resultLibrary/docs/NumberOnly.md new file mode 100644 index 00000000000..72bd361168b --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/NumberOnly.md @@ -0,0 +1,10 @@ +# NumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **Double** | | [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/swift4/resultLibrary/docs/Order.md b/samples/client/petstore/swift4/resultLibrary/docs/Order.md new file mode 100644 index 00000000000..15487f01175 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Order.md @@ -0,0 +1,15 @@ +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**petId** | **Int64** | | [optional] +**quantity** | **Int** | | [optional] +**shipDate** | **Date** | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **Bool** | | [optional] [default to false] + +[[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/swift4/resultLibrary/docs/OuterComposite.md b/samples/client/petstore/swift4/resultLibrary/docs/OuterComposite.md new file mode 100644 index 00000000000..d6b3583bc3f --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/OuterComposite.md @@ -0,0 +1,12 @@ +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **Double** | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **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/swift4/resultLibrary/docs/OuterEnum.md b/samples/client/petstore/swift4/resultLibrary/docs/OuterEnum.md new file mode 100644 index 00000000000..06d413b0168 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/OuterEnum.md @@ -0,0 +1,9 @@ +# OuterEnum + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/swift4/resultLibrary/docs/Pet.md b/samples/client/petstore/swift4/resultLibrary/docs/Pet.md new file mode 100644 index 00000000000..5c05f98fad4 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Pet.md @@ -0,0 +1,15 @@ +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **[String]** | | +**tags** | [Tag] | | [optional] +**status** | **String** | pet status in the store | [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/swift4/resultLibrary/docs/PetAPI.md b/samples/client/petstore/swift4/resultLibrary/docs/PetAPI.md new file mode 100644 index 00000000000..27efe083347 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/PetAPI.md @@ -0,0 +1,469 @@ +# PetAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetAPI.md#addpet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetAPI.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetAPI.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **addPet** +```swift + open class func addPet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Add a new pet to the store + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Pet(id: 123, category: Category(id: 123, name: "name_example"), name: "name_example", photoUrls: ["photoUrls_example"], tags: [Tag(id: 123, name: "name_example")], status: "status_example") // Pet | Pet object that needs to be added to the store + +// Add a new pet to the store +PetAPI.addPet(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **deletePet** +```swift + open class func deletePet(petId: Int64, apiKey: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Deletes a pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | Pet id to delete +let apiKey = "apiKey_example" // String | (optional) + +// Deletes a pet +PetAPI.deletePet(petId: petId, apiKey: apiKey) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | Pet id to delete | + **apiKey** | **String** | | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **findPetsByStatus** +```swift + open class func findPetsByStatus(status: [String], completion: @escaping (_ data: [Pet]?, _ error: Error?) -> Void) +``` + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let status = ["status_example"] // [String] | Status values that need to be considered for filter + +// Finds Pets by status +PetAPI.findPetsByStatus(status: status) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**[String]**](String.md) | Status values that need to be considered for filter | + +### Return type + +[**[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **findPetsByTags** +```swift + open class func findPetsByTags(tags: [String], completion: @escaping (_ data: [Pet]?, _ error: Error?) -> Void) +``` + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let tags = ["inner_example"] // [String] | Tags to filter by + +// Finds Pets by tags +PetAPI.findPetsByTags(tags: tags) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**[String]**](String.md) | Tags to filter by | + +### Return type + +[**[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **getPetById** +```swift + open class func getPetById(petId: Int64, completion: @escaping (_ data: Pet?, _ error: Error?) -> Void) +``` + +Find pet by ID + +Returns a single pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to return + +// Find pet by ID +PetAPI.getPetById(petId: petId) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **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) + +# **updatePet** +```swift + open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Update an existing pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Pet(id: 123, category: Category(id: 123, name: "name_example"), name: "name_example", photoUrls: ["photoUrls_example"], tags: [Tag(id: 123, name: "name_example")], status: "status_example") // Pet | Pet object that needs to be added to the store + +// Update an existing pet +PetAPI.updatePet(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **updatePetWithForm** +```swift + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Updates a pet in the store with form data + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet that needs to be updated +let name = "name_example" // String | Updated name of the pet (optional) +let status = "status_example" // String | Updated status of the pet (optional) + +// Updates a pet in the store with form data +PetAPI.updatePetWithForm(petId: petId, name: name, status: status) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet that needs to be updated | + **name** | **String** | Updated name of the pet | [optional] + **status** | **String** | Updated status of the pet | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **uploadFile** +```swift + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +uploads an image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) +let file = URL(string: "https://example.com")! // URL | file to upload (optional) + +// uploads an image +PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **additionalMetadata** | **String** | Additional data to pass to server | [optional] + **file** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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) + +# **uploadFileWithRequiredFile** +```swift + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +uploads an image (required) + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) + +// uploads an image (required) +PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **requiredFile** | **URL** | file to upload | + **additionalMetadata** | **String** | Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **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/swift4/resultLibrary/docs/ReadOnlyFirst.md b/samples/client/petstore/swift4/resultLibrary/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..ed537b87598 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# ReadOnlyFirst + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**baz** | **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/swift4/resultLibrary/docs/Return.md b/samples/client/petstore/swift4/resultLibrary/docs/Return.md new file mode 100644 index 00000000000..66d17c27c88 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Return.md @@ -0,0 +1,10 @@ +# Return + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Int** | | [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/swift4/resultLibrary/docs/SpecialModelName.md b/samples/client/petstore/swift4/resultLibrary/docs/SpecialModelName.md new file mode 100644 index 00000000000..3ec27a38c2a --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/SpecialModelName.md @@ -0,0 +1,10 @@ +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**specialPropertyName** | **Int64** | | [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/swift4/resultLibrary/docs/StoreAPI.md b/samples/client/petstore/swift4/resultLibrary/docs/StoreAPI.md new file mode 100644 index 00000000000..36365ca5199 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/StoreAPI.md @@ -0,0 +1,206 @@ +# StoreAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreAPI.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreAPI.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreAPI.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreAPI.md#placeorder) | **POST** /store/order | Place an order for a pet + + +# **deleteOrder** +```swift + open class func deleteOrder(orderId: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let orderId = "orderId_example" // String | ID of the order that needs to be deleted + +// Delete purchase order by ID +StoreAPI.deleteOrder(orderId: orderId) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String** | ID of the order that needs to be deleted | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **getInventory** +```swift + open class func getInventory(completion: @escaping (_ data: [String:Int]?, _ error: Error?) -> Void) +``` + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + + +// Returns pet inventories by status +StoreAPI.getInventory() { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**[String:Int]** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **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) + +# **getOrderById** +```swift + open class func getOrderById(orderId: Int64, completion: @escaping (_ data: Order?, _ error: Error?) -> Void) +``` + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let orderId = 987 // Int64 | ID of pet that needs to be fetched + +// Find purchase order by ID +StoreAPI.getOrderById(orderId: orderId) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Int64** | ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **placeOrder** +```swift + open class func placeOrder(body: Order, completion: @escaping (_ data: Order?, _ error: Error?) -> Void) +``` + +Place an order for a pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Order(id: 123, petId: 123, quantity: 123, shipDate: Date(), status: "status_example", complete: false) // Order | order placed for purchasing the pet + +// Place an order for a pet +StoreAPI.placeOrder(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md) | order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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/swift4/resultLibrary/docs/StringBooleanMap.md b/samples/client/petstore/swift4/resultLibrary/docs/StringBooleanMap.md new file mode 100644 index 00000000000..7abf11ec68b --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/StringBooleanMap.md @@ -0,0 +1,9 @@ +# StringBooleanMap + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/swift4/resultLibrary/docs/Tag.md b/samples/client/petstore/swift4/resultLibrary/docs/Tag.md new file mode 100644 index 00000000000..ff4ac8aa451 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/Tag.md @@ -0,0 +1,11 @@ +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [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/swift4/resultLibrary/docs/TypeHolderDefault.md b/samples/client/petstore/swift4/resultLibrary/docs/TypeHolderDefault.md new file mode 100644 index 00000000000..5161394bdc3 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/TypeHolderDefault.md @@ -0,0 +1,14 @@ +# TypeHolderDefault + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | [default to "what"] +**numberItem** | **Double** | | +**integerItem** | **Int** | | +**boolItem** | **Bool** | | [default to true] +**arrayItem** | **[Int]** | | + +[[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/swift4/resultLibrary/docs/TypeHolderExample.md b/samples/client/petstore/swift4/resultLibrary/docs/TypeHolderExample.md new file mode 100644 index 00000000000..46d0471cd71 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/TypeHolderExample.md @@ -0,0 +1,14 @@ +# TypeHolderExample + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | +**numberItem** | **Double** | | +**integerItem** | **Int** | | +**boolItem** | **Bool** | | +**arrayItem** | **[Int]** | | + +[[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/swift4/resultLibrary/docs/User.md b/samples/client/petstore/swift4/resultLibrary/docs/User.md new file mode 100644 index 00000000000..5a439de0ff9 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/User.md @@ -0,0 +1,17 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **Int** | User Status | [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/swift4/resultLibrary/docs/UserAPI.md b/samples/client/petstore/swift4/resultLibrary/docs/UserAPI.md new file mode 100644 index 00000000000..380813bc68c --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/docs/UserAPI.md @@ -0,0 +1,406 @@ +# UserAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserAPI.md#createuser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserAPI.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserAPI.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserAPI.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserAPI.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserAPI.md#loginuser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserAPI.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserAPI.md#updateuser) | **PUT** /user/{username} | Updated user + + +# **createUser** +```swift + open class func createUser(body: User, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Create user + +This can only be done by the logged in user. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123) // User | Created user object + +// Create user +UserAPI.createUser(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md) | Created user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **createUsersWithArrayInput** +```swift + open class func createUsersWithArrayInput(body: [User], completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Creates list of users with given input array + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = [User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123)] // [User] | List of user object + +// Creates list of users with given input array +UserAPI.createUsersWithArrayInput(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[User]**](User.md) | List of user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **createUsersWithListInput** +```swift + open class func createUsersWithListInput(body: [User], completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Creates list of users with given input array + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = [User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123)] // [User] | List of user object + +// Creates list of users with given input array +UserAPI.createUsersWithListInput(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[User]**](User.md) | List of user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **deleteUser** +```swift + open class func deleteUser(username: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Delete user + +This can only be done by the logged in user. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | The name that needs to be deleted + +// Delete user +UserAPI.deleteUser(username: username) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | The name that needs to be deleted | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **getUserByName** +```swift + open class func getUserByName(username: String, completion: @escaping (_ data: User?, _ error: Error?) -> Void) +``` + +Get user by user name + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | The name that needs to be fetched. Use user1 for testing. + +// Get user by user name +UserAPI.getUserByName(username: username) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **loginUser** +```swift + open class func loginUser(username: String, password: String, completion: @escaping (_ data: String?, _ error: Error?) -> Void) +``` + +Logs user into the system + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | The user name for login +let password = "password_example" // String | The password for login in clear text + +// Logs user into the system +UserAPI.loginUser(username: username, password: password) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | The user name for login | + **password** | **String** | The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **logoutUser** +```swift + open class func logoutUser(completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Logs out current logged in user session + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + + +// Logs out current logged in user session +UserAPI.logoutUser() { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **updateUser** +```swift + open class func updateUser(username: String, body: User, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Updated user + +This can only be done by the logged in user. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | name that need to be deleted +let body = User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123) // User | Updated user object + +// Updated user +UserAPI.updateUser(username: username, body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | name that need to be deleted | + **body** | [**User**](User.md) | Updated user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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/swift4/resultLibrary/git_push.sh b/samples/client/petstore/swift4/resultLibrary/git_push.sh new file mode 100644 index 00000000000..ced3be2b0c7 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/swift4/resultLibrary/pom.xml b/samples/client/petstore/swift4/resultLibrary/pom.xml new file mode 100644 index 00000000000..5caba9cb463 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + io.swagger + Swift4PetstoreClientTests + pom + 1.0-SNAPSHOT + Swift4 Swagger Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + xcodebuild-test + integration-test + + exec + + + ./run_spmbuild.sh + + + + + + + diff --git a/samples/client/petstore/swift4/resultLibrary/project.yml b/samples/client/petstore/swift4/resultLibrary/project.yml new file mode 100644 index 00000000000..148b42517be --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/project.yml @@ -0,0 +1,15 @@ +name: PetstoreClient +targets: + PetstoreClient: + type: framework + platform: iOS + deploymentTarget: "10.0" + sources: [PetstoreClient] + info: + path: ./Info.plist + version: 1.0.0 + settings: + APPLICATION_EXTENSION_API_ONLY: true + scheme: {} + dependencies: + - carthage: Alamofire diff --git a/samples/client/petstore/swift4/resultLibrary/run_spmbuild.sh b/samples/client/petstore/swift4/resultLibrary/run_spmbuild.sh new file mode 100755 index 00000000000..1a9f585ad05 --- /dev/null +++ b/samples/client/petstore/swift4/resultLibrary/run_spmbuild.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +swift build && exit ${PIPESTATUS[0]} diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index 9e4312f685d..832282d224f 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -11,6 +11,7 @@ open class PetstoreClientAPI { public static var credential: URLCredential? public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() + public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder { diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 0d88a4bad98..819fc85beda 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import RxSwift open class AnotherFakeAPI { diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 474af3c46cc..edbc9b6fffc 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import RxSwift open class FakeAPI { @@ -236,7 +235,7 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": query + "query": query.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -348,17 +347,17 @@ open class FakeAPI { "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), - "number": number, - "float": float, - "double": double, - "string": string, - "pattern_without_delimiter": patternWithoutDelimiter, - "byte": byte, - "binary": binary, + "number": number.encodeToJSON(), + "float": float?.encodeToJSON(), + "double": double.encodeToJSON(), + "string": string?.encodeToJSON(), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(), + "byte": byte.encodeToJSON(), + "binary": binary?.encodeToJSON(), "date": date?.encodeToJSON(), "dateTime": dateTime?.encodeToJSON(), - "password": password, - "callback": callback + "password": password?.encodeToJSON(), + "callback": callback?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -442,13 +441,13 @@ open class FakeAPI { To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: Observable */ open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> Observable { @@ -470,21 +469,21 @@ open class FakeAPI { - GET /fake - To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: RequestBuilder */ open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray, - "enum_form_string": enumFormString?.rawValue + "enum_form_string_array": enumFormStringArray?.encodeToJSON(), + "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -492,14 +491,14 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray, - "enum_query_string": enumQueryString?.rawValue, - "enum_query_integer": enumQueryInteger?.rawValue, - "enum_query_double": enumQueryDouble?.rawValue + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "enum_header_string_array": enumHeaderStringArray, - "enum_header_string": enumHeaderString?.rawValue + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(), + "enum_header_string": enumHeaderString?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -558,8 +557,8 @@ open class FakeAPI { "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup, - "boolean_group": booleanGroup + "required_boolean_group": requiredBooleanGroup.encodeToJSON(), + "boolean_group": booleanGroup?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -638,8 +637,8 @@ open class FakeAPI { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "param": param, - "param2": param2 + "param": param.encodeToJSON(), + "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index a4e7d073c9a..c34ace880ce 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import RxSwift open class FakeClassnameTags123API { diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 8231330d1c8..6b4797fc19a 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import RxSwift open class PetAPI { @@ -92,7 +91,7 @@ open class PetAPI { let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ - "api_key": apiKey + "api_key": apiKey?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -149,7 +148,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": status + "status": status.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -196,7 +195,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": tags + "tags": tags.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -332,8 +331,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "name": name, - "status": status + "name": name?.encodeToJSON(), + "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -388,8 +387,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "file": file + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -444,8 +443,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "requiredFile": requiredFile + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index b0e3d380fca..c03311277b9 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import RxSwift open class StoreAPI { diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index a50f0f0e9bf..ec28b4121d0 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire import RxSwift open class UserAPI { @@ -248,8 +247,8 @@ open class UserAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username, - "password": password + "username": username.encodeToJSON(), + "password": password.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index 60ce28c66a2..1d54e695608 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -156,7 +156,7 @@ open class AlamofireRequestBuilder: RequestBuilder { switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -176,7 +176,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) case is URL.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() do { @@ -226,7 +226,7 @@ open class AlamofireRequestBuilder: RequestBuilder { return }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -245,7 +245,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -358,7 +358,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -378,7 +378,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -397,7 +397,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Data.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -417,7 +417,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse: DataResponse) in cleanupRequest() guard dataResponse.result.isSuccess else { diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2fa32b9e0f3..f8faed255bf 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -5,7 +5,6 @@ // import Foundation -import Alamofire extension Bool: JSONEncodable { func encodeToJSON() -> Any { return self as Any } @@ -35,6 +34,10 @@ extension String: JSONEncodable { func encodeToJSON() -> Any { return self as Any } } +extension RawRepresentable where RawValue: JSONEncodable { + func encodeToJSON() -> Any { return self.rawValue as Any } +} + private func encodeIfPossible(_ object: T) -> Any { if let encodableObject = object as? JSONEncodable { return encodableObject.encodeToJSON() @@ -84,6 +87,12 @@ extension Date: JSONEncodable { } } +extension URL: JSONEncodable { + func encodeToJSON() -> Any { + return self + } +} + extension UUID: JSONEncodable { func encodeToJSON() -> Any { return self.uuidString diff --git a/samples/client/petstore/swift4/rxswiftLibrary/docs/FakeAPI.md b/samples/client/petstore/swift4/rxswiftLibrary/docs/FakeAPI.md index a67ef1c2815..a9a6c32c98b 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/docs/FakeAPI.md +++ b/samples/client/petstore/swift4/rxswiftLibrary/docs/FakeAPI.md @@ -379,13 +379,13 @@ To test enum parameters import PetstoreClient let enumHeaderStringArray = ["enumHeaderStringArray_example"] // [String] | Header parameter enum test (string array) (optional) -let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .-efg) +let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .efg) let enumQueryStringArray = ["enumQueryStringArray_example"] // [String] | Query parameter enum test (string array) (optional) -let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .-efg) +let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .efg) let enumQueryInteger = 987 // Int | Query parameter enum test (double) (optional) let enumQueryDouble = 987 // Double | Query parameter enum test (double) (optional) -let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .$) -let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .-efg) +let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .dollar) +let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .efg) // TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new ``` @@ -395,13 +395,13 @@ let enumFormString = "enumFormString_example" // String | Form parameter enum te Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **enumHeaderStringArray** | [**[String]**](String.md) | Header parameter enum test (string array) | [optional] - **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .-efg] + **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .efg] **enumQueryStringArray** | [**[String]**](String.md) | Query parameter enum test (string array) | [optional] - **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .-efg] + **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .efg] **enumQueryInteger** | **Int** | Query parameter enum test (double) | [optional] **enumQueryDouble** | **Double** | Query parameter enum test (double) | [optional] - **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .$] - **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .-efg] + **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .dollar] + **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .efg] ### Return type diff --git a/samples/client/petstore/swift4/swift4_test_all.sh b/samples/client/petstore/swift4/swift4_test_all.sh index 4d302a15692..68a2475c71b 100755 --- a/samples/client/petstore/swift4/swift4_test_all.sh +++ b/samples/client/petstore/swift4/swift4_test_all.sh @@ -11,7 +11,9 @@ mvn -f $DIRECTORY/rxswiftLibrary/SwaggerClientTests/pom.xml integration-test # spm build mvn -f $DIRECTORY/default/pom.xml integration-test +mvn -f $DIRECTORY/nonPublicApi/pom.xml integration-test mvn -f $DIRECTORY/objcCompatible/pom.xml integration-test mvn -f $DIRECTORY/promisekitLibrary/pom.xml integration-test +mvn -f $DIRECTORY/resultLibrary/pom.xml integration-test mvn -f $DIRECTORY/rxswiftLibrary/pom.xml integration-test mvn -f $DIRECTORY/unwrapRequired/pom.xml integration-test diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs.swift index 9e4312f685d..832282d224f 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -11,6 +11,7 @@ open class PetstoreClientAPI { public static var credential: URLCredential? public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() + public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder { diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 30b346de0e1..02e24286e3c 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class AnotherFakeAPI { /** diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d1f658b08d8..b0b394aa06e 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class FakeAPI { /** @@ -187,7 +186,7 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": query + "query": query.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -285,17 +284,17 @@ open class FakeAPI { "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), - "number": number, - "float": float, - "double": double, - "string": string, - "pattern_without_delimiter": patternWithoutDelimiter, - "byte": byte, - "binary": binary, + "number": number.encodeToJSON(), + "float": float?.encodeToJSON(), + "double": double.encodeToJSON(), + "string": string?.encodeToJSON(), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(), + "byte": byte.encodeToJSON(), + "binary": binary?.encodeToJSON(), "date": date?.encodeToJSON(), "dateTime": dateTime?.encodeToJSON(), - "password": password, - "callback": callback + "password": password?.encodeToJSON(), + "callback": callback?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -379,13 +378,13 @@ open class FakeAPI { To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - parameter completion: completion handler to receive the data and the error objects */ open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { @@ -403,21 +402,21 @@ open class FakeAPI { - GET /fake - To test enum parameters - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) - - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .-efg) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) - - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .-efg) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) - - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .-efg) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: RequestBuilder */ open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray, - "enum_form_string": enumFormString?.rawValue + "enum_form_string_array": enumFormStringArray?.encodeToJSON(), + "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -425,14 +424,14 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray, - "enum_query_string": enumQueryString?.rawValue, - "enum_query_integer": enumQueryInteger?.rawValue, - "enum_query_double": enumQueryDouble?.rawValue + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "enum_header_string_array": enumHeaderStringArray, - "enum_header_string": enumHeaderString?.rawValue + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(), + "enum_header_string": enumHeaderString?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -487,8 +486,8 @@ open class FakeAPI { "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup, - "boolean_group": booleanGroup + "required_boolean_group": requiredBooleanGroup.encodeToJSON(), + "boolean_group": booleanGroup?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -559,8 +558,8 @@ open class FakeAPI { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "param": param, - "param2": param2 + "param": param.encodeToJSON(), + "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 6bfa09016f5..060d434fbf2 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class FakeClassnameTags123API { /** diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 39525475748..fe75962a72c 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class PetAPI { /** @@ -83,7 +82,7 @@ open class PetAPI { let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ - "api_key": apiKey + "api_key": apiKey?.encodeToJSON() ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -130,7 +129,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": status + "status": status.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -167,7 +166,7 @@ open class PetAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": tags + "tags": tags.encodeToJSON() ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -285,8 +284,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "name": name, - "status": status + "name": name?.encodeToJSON(), + "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -331,8 +330,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "file": file + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -377,8 +376,8 @@ open class PetAPI { path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata, - "requiredFile": requiredFile + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 98ff7b54742..d5f627df52a 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class StoreAPI { /** diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 24d0d35e9dd..ef4f971a91e 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class UserAPI { /** @@ -211,8 +210,8 @@ open class UserAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username, - "password": password + "username": username.encodeToJSON(), + "password": password.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index 60ce28c66a2..1d54e695608 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -156,7 +156,7 @@ open class AlamofireRequestBuilder: RequestBuilder { switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -176,7 +176,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) case is URL.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() do { @@ -226,7 +226,7 @@ open class AlamofireRequestBuilder: RequestBuilder { return }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -245,7 +245,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -358,7 +358,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -378,7 +378,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -397,7 +397,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Data.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -417,7 +417,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + validatedRequest.responseData(queue: PetstoreClientAPI.apiResponseQueue, completionHandler: { (dataResponse: DataResponse) in cleanupRequest() guard dataResponse.result.isSuccess else { diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2fa32b9e0f3..f8faed255bf 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -5,7 +5,6 @@ // import Foundation -import Alamofire extension Bool: JSONEncodable { func encodeToJSON() -> Any { return self as Any } @@ -35,6 +34,10 @@ extension String: JSONEncodable { func encodeToJSON() -> Any { return self as Any } } +extension RawRepresentable where RawValue: JSONEncodable { + func encodeToJSON() -> Any { return self.rawValue as Any } +} + private func encodeIfPossible(_ object: T) -> Any { if let encodableObject = object as? JSONEncodable { return encodableObject.encodeToJSON() @@ -84,6 +87,12 @@ extension Date: JSONEncodable { } } +extension URL: JSONEncodable { + func encodeToJSON() -> Any { + return self + } +} + extension UUID: JSONEncodable { func encodeToJSON() -> Any { return self.uuidString diff --git a/samples/client/petstore/swift4/unwrapRequired/docs/FakeAPI.md b/samples/client/petstore/swift4/unwrapRequired/docs/FakeAPI.md index 18fbf8147d8..49d4d3fb6a1 100644 --- a/samples/client/petstore/swift4/unwrapRequired/docs/FakeAPI.md +++ b/samples/client/petstore/swift4/unwrapRequired/docs/FakeAPI.md @@ -453,13 +453,13 @@ To test enum parameters import PetstoreClient let enumHeaderStringArray = ["enumHeaderStringArray_example"] // [String] | Header parameter enum test (string array) (optional) -let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .-efg) +let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .efg) let enumQueryStringArray = ["enumQueryStringArray_example"] // [String] | Query parameter enum test (string array) (optional) -let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .-efg) +let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .efg) let enumQueryInteger = 987 // Int | Query parameter enum test (double) (optional) let enumQueryDouble = 987 // Double | Query parameter enum test (double) (optional) -let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .$) -let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .-efg) +let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .dollar) +let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .efg) // To test enum parameters FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString) { (response, error) in @@ -479,13 +479,13 @@ FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHea Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **enumHeaderStringArray** | [**[String]**](String.md) | Header parameter enum test (string array) | [optional] - **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .-efg] + **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .efg] **enumQueryStringArray** | [**[String]**](String.md) | Query parameter enum test (string array) | [optional] - **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .-efg] + **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .efg] **enumQueryInteger** | **Int** | Query parameter enum test (double) | [optional] **enumQueryDouble** | **Double** | Query parameter enum test (double) | [optional] - **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .$] - **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .-efg] + **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .dollar] + **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .efg] ### Return type diff --git a/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts index df0ef7ccd01..36d9db6744e 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts @@ -246,6 +246,7 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -291,6 +292,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -340,6 +342,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -390,6 +393,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -432,6 +436,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -484,6 +489,7 @@ export class PetService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -554,6 +560,7 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: convertFormParamsToString ? formParams.toString() : formParams, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -628,6 +635,7 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: convertFormParamsToString ? formParams.toString() : formParams, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts index 9a84a67805e..5a2292441dd 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts @@ -140,6 +140,7 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -176,6 +177,7 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -212,6 +214,7 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -256,6 +259,7 @@ export class StoreService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts index 49f4c7f4732..229426692fe 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts @@ -219,6 +219,7 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -261,6 +262,7 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -303,6 +305,7 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -337,6 +340,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -372,6 +376,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -419,6 +424,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -449,6 +455,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -496,6 +503,7 @@ export class UserService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts index df0ef7ccd01..36d9db6744e 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts @@ -246,6 +246,7 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -291,6 +292,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -340,6 +342,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -390,6 +393,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -432,6 +436,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -484,6 +489,7 @@ export class PetService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -554,6 +560,7 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: convertFormParamsToString ? formParams.toString() : formParams, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -628,6 +635,7 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: convertFormParamsToString ? formParams.toString() : formParams, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts index 9a84a67805e..5a2292441dd 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts @@ -140,6 +140,7 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -176,6 +177,7 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -212,6 +214,7 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -256,6 +259,7 @@ export class StoreService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts index 49f4c7f4732..229426692fe 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts @@ -219,6 +219,7 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -261,6 +262,7 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -303,6 +305,7 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -337,6 +340,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -372,6 +376,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -419,6 +424,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -449,6 +455,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -496,6 +503,7 @@ export class UserService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts index 4937a32e7bb..ee64586f950 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts @@ -249,6 +249,7 @@ export class PetService implements PetServiceInterface { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -294,6 +295,7 @@ export class PetService implements PetServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -343,6 +345,7 @@ export class PetService implements PetServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -393,6 +396,7 @@ export class PetService implements PetServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -435,6 +439,7 @@ export class PetService implements PetServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -487,6 +492,7 @@ export class PetService implements PetServiceInterface { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -557,6 +563,7 @@ export class PetService implements PetServiceInterface { method: RequestMethod.Post, headers: headers, body: convertFormParamsToString ? formParams.toString() : formParams, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -631,6 +638,7 @@ export class PetService implements PetServiceInterface { method: RequestMethod.Post, headers: headers, body: convertFormParamsToString ? formParams.toString() : formParams, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts index 744e2a3e9b5..6b2eee80069 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts @@ -143,6 +143,7 @@ export class StoreService implements StoreServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -179,6 +180,7 @@ export class StoreService implements StoreServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -215,6 +217,7 @@ export class StoreService implements StoreServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -259,6 +262,7 @@ export class StoreService implements StoreServiceInterface { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts index 1b4542f3e8b..d999f296618 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts @@ -222,6 +222,7 @@ export class UserService implements UserServiceInterface { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -264,6 +265,7 @@ export class UserService implements UserServiceInterface { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -306,6 +308,7 @@ export class UserService implements UserServiceInterface { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -340,6 +343,7 @@ export class UserService implements UserServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -375,6 +379,7 @@ export class UserService implements UserServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -422,6 +427,7 @@ export class UserService implements UserServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -452,6 +458,7 @@ export class UserService implements UserServiceInterface { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -499,6 +506,7 @@ export class UserService implements UserServiceInterface { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts index 7fe1b177c46..61b38e3aa07 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts @@ -104,9 +104,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -152,8 +158,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -203,9 +215,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -255,9 +273,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -299,8 +323,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -352,9 +382,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -420,9 +456,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -492,9 +534,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts index fc37529edc6..7d46fee178f 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts @@ -73,8 +73,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -111,8 +117,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -149,8 +161,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -194,9 +212,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts index b1cb03cc470..4ae84764be3 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts @@ -81,9 +81,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -125,9 +131,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -169,9 +181,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -206,8 +224,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -243,8 +267,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -292,9 +322,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -324,8 +360,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -372,9 +414,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts index df0ef7ccd01..36d9db6744e 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts @@ -246,6 +246,7 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -291,6 +292,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -340,6 +342,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -390,6 +393,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -432,6 +436,7 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -484,6 +489,7 @@ export class PetService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -554,6 +560,7 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: convertFormParamsToString ? formParams.toString() : formParams, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -628,6 +635,7 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: convertFormParamsToString ? formParams.toString() : formParams, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts index 9a84a67805e..5a2292441dd 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts @@ -140,6 +140,7 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -176,6 +177,7 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -212,6 +214,7 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -256,6 +259,7 @@ export class StoreService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts index 49f4c7f4732..229426692fe 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts @@ -219,6 +219,7 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -261,6 +262,7 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -303,6 +305,7 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -337,6 +340,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -372,6 +376,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -419,6 +424,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, search: queryParameters, withCredentials:this.configuration.withCredentials }); @@ -449,6 +455,7 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 @@ -496,6 +503,7 @@ export class UserService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 + responseType: httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text') ? ResponseContentType.Text : ResponseContentType.Json, withCredentials:this.configuration.withCredentials }); // issues#4037 diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts index 9e5456808b8..f0b0cff753c 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts @@ -104,9 +104,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -152,8 +158,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -203,9 +215,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -255,9 +273,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -299,8 +323,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -352,9 +382,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -420,9 +456,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -492,9 +534,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts index b64d961c32c..68737439b9a 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts @@ -73,8 +73,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -111,8 +117,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -149,8 +161,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -194,9 +212,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts index 8064a6da574..cb25ca73c0f 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts @@ -81,9 +81,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -125,9 +131,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -169,9 +181,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -206,8 +224,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -243,8 +267,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -292,9 +322,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -324,8 +360,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -372,9 +414,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts index 9e5456808b8..f0b0cff753c 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts @@ -104,9 +104,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -152,8 +158,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -203,9 +215,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -255,9 +273,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -299,8 +323,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -352,9 +382,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -420,9 +456,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -492,9 +534,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts index b64d961c32c..68737439b9a 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts @@ -73,8 +73,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -111,8 +117,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -149,8 +161,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -194,9 +212,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts index 8064a6da574..cb25ca73c0f 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts @@ -81,9 +81,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -125,9 +131,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -169,9 +181,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -206,8 +224,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -243,8 +267,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -292,9 +322,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -324,8 +360,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -372,9 +414,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts index dd6227c1ce0..110615d2f42 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts @@ -106,9 +106,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -154,8 +160,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -205,9 +217,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -257,9 +275,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -301,8 +325,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -354,9 +384,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -422,9 +458,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -494,9 +536,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts index dae6e4e90a6..0bacbf87c22 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts @@ -75,8 +75,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -113,8 +119,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -151,8 +163,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -196,9 +214,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts index 00aa65bec1a..d344374967d 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts @@ -83,9 +83,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -127,9 +133,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -171,9 +183,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -208,8 +226,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -245,8 +269,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -294,9 +324,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -326,8 +362,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -374,9 +416,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts index dd6227c1ce0..110615d2f42 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts @@ -106,9 +106,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -154,8 +160,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -205,9 +217,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -257,9 +275,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -301,8 +325,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -354,9 +384,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -422,9 +458,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -494,9 +536,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts index dae6e4e90a6..0bacbf87c22 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts @@ -75,8 +75,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -113,8 +119,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -151,8 +163,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -196,9 +214,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts index 00aa65bec1a..d344374967d 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts @@ -83,9 +83,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -127,9 +133,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -171,9 +183,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -208,8 +226,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -245,8 +269,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -294,9 +324,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -326,8 +362,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -374,9 +416,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts index 9e5456808b8..f0b0cff753c 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts @@ -104,9 +104,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -152,8 +158,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -203,9 +215,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -255,9 +273,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -299,8 +323,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -352,9 +382,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -420,9 +456,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -492,9 +534,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts index b64d961c32c..68737439b9a 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts @@ -73,8 +73,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -111,8 +117,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -149,8 +161,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -194,9 +212,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts index 8064a6da574..cb25ca73c0f 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts @@ -81,9 +81,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -125,9 +131,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -169,9 +181,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -206,8 +224,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -243,8 +267,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -292,9 +322,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -324,8 +360,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -372,9 +414,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts index 9e5456808b8..f0b0cff753c 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts @@ -104,9 +104,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -152,8 +158,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -203,9 +215,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -255,9 +273,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -299,8 +323,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -352,9 +382,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -420,9 +456,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -492,9 +534,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts index b64d961c32c..68737439b9a 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts @@ -73,8 +73,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -111,8 +117,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -149,8 +161,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -194,9 +212,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts index 8064a6da574..cb25ca73c0f 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts @@ -81,9 +81,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -125,9 +131,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -169,9 +181,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -206,8 +224,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -243,8 +267,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -292,9 +322,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -324,8 +360,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -372,9 +414,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts index dd6227c1ce0..110615d2f42 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts @@ -106,9 +106,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -154,8 +160,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -205,9 +217,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -257,9 +275,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -301,8 +325,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -354,9 +384,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -422,9 +458,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -494,9 +536,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts index dae6e4e90a6..0bacbf87c22 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts @@ -75,8 +75,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -113,8 +119,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -151,8 +163,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -196,9 +214,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts index 00aa65bec1a..d344374967d 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts @@ -83,9 +83,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -127,9 +133,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -171,9 +183,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -208,8 +226,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -245,8 +269,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -294,9 +324,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -326,8 +362,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -374,9 +416,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts index dd6227c1ce0..110615d2f42 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts @@ -106,9 +106,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -154,8 +160,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -205,9 +217,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -257,9 +275,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -301,8 +325,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -354,9 +384,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -422,9 +458,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -494,9 +536,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts index dae6e4e90a6..0bacbf87c22 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts @@ -75,8 +75,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -113,8 +119,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -151,8 +163,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -196,9 +214,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts index 00aa65bec1a..d344374967d 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts @@ -83,9 +83,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -127,9 +133,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -171,9 +183,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -208,8 +226,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -245,8 +269,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -294,9 +324,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -326,8 +362,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -374,9 +416,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts index 4156b6a005e..1ab6514d615 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts @@ -144,9 +144,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -193,8 +199,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -245,9 +257,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -298,9 +316,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -343,8 +367,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -397,9 +427,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -466,9 +502,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -539,9 +581,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts index f5ce3496728..624eed3ea74 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts @@ -88,8 +88,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -126,8 +132,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -165,8 +177,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -211,9 +229,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts index 00056c76771..02f139bd64a 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts @@ -114,9 +114,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -159,9 +165,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -204,9 +216,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -242,8 +260,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -280,8 +304,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -330,9 +360,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -362,8 +398,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -411,9 +453,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts index dd6227c1ce0..110615d2f42 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts @@ -106,9 +106,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -154,8 +160,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -205,9 +217,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -257,9 +275,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -301,8 +325,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -354,9 +384,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -422,9 +458,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -494,9 +536,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts index dae6e4e90a6..0bacbf87c22 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts @@ -75,8 +75,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -113,8 +119,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -151,8 +163,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -196,9 +214,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts index 00aa65bec1a..d344374967d 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts @@ -83,9 +83,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -127,9 +133,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -171,9 +183,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -208,8 +226,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -245,8 +269,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -294,9 +324,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -326,8 +362,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -374,9 +416,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts index dd6227c1ce0..110615d2f42 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts @@ -106,9 +106,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -154,8 +160,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -205,9 +217,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByStatus`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -257,9 +275,15 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get>(`${this.configuration.basePath}/pet/findByTags`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -301,8 +325,14 @@ export class PetService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -354,9 +384,15 @@ export class PetService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/pet`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -422,9 +458,15 @@ export class PetService { formParams = formParams.append('status', status) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -494,9 +536,15 @@ export class PetService { formParams = formParams.append('file', file) as any || formParams; } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts index dae6e4e90a6..0bacbf87c22 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts @@ -75,8 +75,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -113,8 +119,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -151,8 +163,14 @@ export class StoreService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -196,9 +214,15 @@ export class StoreService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/store/order`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts index 00aa65bec1a..d344374967d 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts @@ -83,9 +83,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -127,9 +133,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithArray`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -171,9 +183,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.post(`${this.configuration.basePath}/user/createWithList`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -208,8 +226,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.delete(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -245,8 +269,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -294,9 +324,15 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/login`, { params: queryParameters, + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -326,8 +362,14 @@ export class UserService { } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.get(`${this.configuration.basePath}/user/logout`, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -374,9 +416,15 @@ export class UserService { headers = headers.set('Content-Type', httpContentTypeSelected); } + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + return this.httpClient.put(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, body, { + responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts index a21e1e1ed99..22aa191ef5f 100644 --- a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-node/default/api/petApi.ts b/samples/client/petstore/typescript-node/default/api/petApi.ts index e943ad7a582..c6794b6145d 100644 --- a/samples/client/petstore/typescript-node/default/api/petApi.ts +++ b/samples/client/petstore/typescript-node/default/api/petApi.ts @@ -17,8 +17,8 @@ import http = require('http'); import { ApiResponse } from '../model/apiResponse'; import { Pet } from '../model/pet'; -import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; -import { HttpBasicAuth, ApiKeyAuth, OAuth } from '../model/models'; +import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; +import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; import { HttpError, RequestFile } from './apis'; @@ -43,6 +43,8 @@ export class PetApi { 'api_key': new ApiKeyAuth('header', 'api_key'), } + protected interceptors: Interceptor[] = []; + constructor(basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { @@ -80,6 +82,10 @@ export class PetApi { this.authentications.petstore_auth.accessToken = token; } + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + /** * * @summary Add a new pet to the store @@ -114,7 +120,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -173,7 +185,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -240,7 +258,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -308,7 +332,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -373,7 +403,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.api_key.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -431,7 +467,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -498,7 +540,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -573,7 +621,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; diff --git a/samples/client/petstore/typescript-node/default/api/storeApi.ts b/samples/client/petstore/typescript-node/default/api/storeApi.ts index 2acc326108e..501a3195ab2 100644 --- a/samples/client/petstore/typescript-node/default/api/storeApi.ts +++ b/samples/client/petstore/typescript-node/default/api/storeApi.ts @@ -16,8 +16,8 @@ import http = require('http'); /* tslint:disable:no-unused-locals */ import { Order } from '../model/order'; -import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; -import { HttpBasicAuth, ApiKeyAuth, OAuth } from '../model/models'; +import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; +import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; import { HttpError, RequestFile } from './apis'; @@ -41,6 +41,8 @@ export class StoreApi { 'api_key': new ApiKeyAuth('header', 'api_key'), } + protected interceptors: Interceptor[] = []; + constructor(basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { @@ -74,6 +76,10 @@ export class StoreApi { (this.authentications as any)[StoreApiApiKeys[key]].apiKey = value; } + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID @@ -106,7 +112,13 @@ export class StoreApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -163,7 +175,13 @@ export class StoreApi { authenticationPromise = authenticationPromise.then(() => this.authentications.api_key.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -226,7 +244,13 @@ export class StoreApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -289,7 +313,13 @@ export class StoreApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; diff --git a/samples/client/petstore/typescript-node/default/api/userApi.ts b/samples/client/petstore/typescript-node/default/api/userApi.ts index 6443289f02e..75c68547809 100644 --- a/samples/client/petstore/typescript-node/default/api/userApi.ts +++ b/samples/client/petstore/typescript-node/default/api/userApi.ts @@ -16,7 +16,7 @@ import http = require('http'); /* tslint:disable:no-unused-locals */ import { User } from '../model/user'; -import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; +import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; import { HttpError, RequestFile } from './apis'; @@ -38,6 +38,8 @@ export class UserApi { 'default': new VoidAuth(), } + protected interceptors: Interceptor[] = []; + constructor(basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { @@ -71,6 +73,10 @@ export class UserApi { (this.authentications as any)[UserApiApiKeys[key]].apiKey = value; } + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + /** * This can only be done by the logged in user. * @summary Create user @@ -103,7 +109,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -158,7 +170,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -213,7 +231,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -268,7 +292,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -330,7 +360,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -406,7 +442,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -455,7 +497,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -517,7 +565,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; diff --git a/samples/client/petstore/typescript-node/default/model/models.ts b/samples/client/petstore/typescript-node/default/model/models.ts index 7aea0f15444..faf72498f76 100644 --- a/samples/client/petstore/typescript-node/default/model/models.ts +++ b/samples/client/petstore/typescript-node/default/model/models.ts @@ -169,6 +169,19 @@ export class HttpBasicAuth implements Authentication { } } +export class HttpBearerAuth implements Authentication { + public accessToken: string | (() => string) = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + const accessToken = typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + requestOptions.headers["Authorization"] = "Bearer " + accessToken; + } + } +} + export class ApiKeyAuth implements Authentication { public apiKey: string = ''; @@ -208,4 +221,6 @@ export class VoidAuth implements Authentication { applyToRequest(_: localVarRequest.Options): void { // Do nothing } -} \ No newline at end of file +} + +export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise | void); diff --git a/samples/client/petstore/typescript-node/npm/api/petApi.ts b/samples/client/petstore/typescript-node/npm/api/petApi.ts index e943ad7a582..c6794b6145d 100644 --- a/samples/client/petstore/typescript-node/npm/api/petApi.ts +++ b/samples/client/petstore/typescript-node/npm/api/petApi.ts @@ -17,8 +17,8 @@ import http = require('http'); import { ApiResponse } from '../model/apiResponse'; import { Pet } from '../model/pet'; -import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; -import { HttpBasicAuth, ApiKeyAuth, OAuth } from '../model/models'; +import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; +import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; import { HttpError, RequestFile } from './apis'; @@ -43,6 +43,8 @@ export class PetApi { 'api_key': new ApiKeyAuth('header', 'api_key'), } + protected interceptors: Interceptor[] = []; + constructor(basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { @@ -80,6 +82,10 @@ export class PetApi { this.authentications.petstore_auth.accessToken = token; } + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + /** * * @summary Add a new pet to the store @@ -114,7 +120,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -173,7 +185,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -240,7 +258,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -308,7 +332,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -373,7 +403,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.api_key.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -431,7 +467,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -498,7 +540,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -573,7 +621,13 @@ export class PetApi { authenticationPromise = authenticationPromise.then(() => this.authentications.petstore_auth.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; diff --git a/samples/client/petstore/typescript-node/npm/api/storeApi.ts b/samples/client/petstore/typescript-node/npm/api/storeApi.ts index 2acc326108e..501a3195ab2 100644 --- a/samples/client/petstore/typescript-node/npm/api/storeApi.ts +++ b/samples/client/petstore/typescript-node/npm/api/storeApi.ts @@ -16,8 +16,8 @@ import http = require('http'); /* tslint:disable:no-unused-locals */ import { Order } from '../model/order'; -import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; -import { HttpBasicAuth, ApiKeyAuth, OAuth } from '../model/models'; +import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; +import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; import { HttpError, RequestFile } from './apis'; @@ -41,6 +41,8 @@ export class StoreApi { 'api_key': new ApiKeyAuth('header', 'api_key'), } + protected interceptors: Interceptor[] = []; + constructor(basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { @@ -74,6 +76,10 @@ export class StoreApi { (this.authentications as any)[StoreApiApiKeys[key]].apiKey = value; } + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID @@ -106,7 +112,13 @@ export class StoreApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -163,7 +175,13 @@ export class StoreApi { authenticationPromise = authenticationPromise.then(() => this.authentications.api_key.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -226,7 +244,13 @@ export class StoreApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -289,7 +313,13 @@ export class StoreApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; diff --git a/samples/client/petstore/typescript-node/npm/api/userApi.ts b/samples/client/petstore/typescript-node/npm/api/userApi.ts index 6443289f02e..75c68547809 100644 --- a/samples/client/petstore/typescript-node/npm/api/userApi.ts +++ b/samples/client/petstore/typescript-node/npm/api/userApi.ts @@ -16,7 +16,7 @@ import http = require('http'); /* tslint:disable:no-unused-locals */ import { User } from '../model/user'; -import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; +import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; import { HttpError, RequestFile } from './apis'; @@ -38,6 +38,8 @@ export class UserApi { 'default': new VoidAuth(), } + protected interceptors: Interceptor[] = []; + constructor(basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { @@ -71,6 +73,10 @@ export class UserApi { (this.authentications as any)[UserApiApiKeys[key]].apiKey = value; } + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + /** * This can only be done by the logged in user. * @summary Create user @@ -103,7 +109,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -158,7 +170,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -213,7 +231,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -268,7 +292,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -330,7 +360,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -406,7 +442,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -455,7 +497,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; @@ -517,7 +565,13 @@ export class UserApi { let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; diff --git a/samples/client/petstore/typescript-node/npm/model/models.ts b/samples/client/petstore/typescript-node/npm/model/models.ts index 7aea0f15444..faf72498f76 100644 --- a/samples/client/petstore/typescript-node/npm/model/models.ts +++ b/samples/client/petstore/typescript-node/npm/model/models.ts @@ -169,6 +169,19 @@ export class HttpBasicAuth implements Authentication { } } +export class HttpBearerAuth implements Authentication { + public accessToken: string | (() => string) = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + const accessToken = typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + requestOptions.headers["Authorization"] = "Bearer " + accessToken; + } + } +} + export class ApiKeyAuth implements Authentication { public apiKey: string = ''; @@ -208,4 +221,6 @@ export class VoidAuth implements Authentication { applyToRequest(_: localVarRequest.Options): void { // Do nothing } -} \ No newline at end of file +} + +export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise | void); diff --git a/samples/client/petstore/typescript-redux-query/builds/default/.openapi-generator/VERSION b/samples/client/petstore/typescript-redux-query/builds/default/.openapi-generator/VERSION index e4955748d3e..58592f031f6 100644 --- a/samples/client/petstore/typescript-redux-query/builds/default/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-redux-query/builds/default/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.2-SNAPSHOT \ No newline at end of file +4.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIHelper.swift index 75dea243957..20007009680 100644 --- a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIHelper.swift @@ -22,7 +22,7 @@ public struct APIHelper { public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array { + if let collection = item.value as? [Any?] { result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" @@ -46,7 +46,7 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source @@ -54,7 +54,7 @@ public struct APIHelper { public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array { + if let collection = item.value as? [Any?] { let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") result.append(URLQueryItem(name: item.key, value: value)) } else if let value = item.value { diff --git a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIs.swift b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIs.swift index e60b6154004..b8c1ec2d40d 100644 --- a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIs.swift @@ -11,6 +11,7 @@ open class TestClientAPI { public static var credential: URLCredential? public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() + public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder { diff --git a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIs/Swift4TestAPI.swift b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIs/Swift4TestAPI.swift index a775c2aaaac..4eb3cd23281 100644 --- a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIs/Swift4TestAPI.swift +++ b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/APIs/Swift4TestAPI.swift @@ -6,7 +6,6 @@ // import Foundation -import Alamofire open class Swift4TestAPI { /** diff --git a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/AlamofireImplementations.swift index 60ce28c66a2..1487a4730f7 100644 --- a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -156,7 +156,7 @@ open class AlamofireRequestBuilder: RequestBuilder { switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: TestClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -176,7 +176,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) case is URL.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: TestClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() do { @@ -226,7 +226,7 @@ open class AlamofireRequestBuilder: RequestBuilder { return }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: TestClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -245,7 +245,7 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: TestClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -358,7 +358,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(queue: TestClientAPI.apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() if stringResponse.result.isFailure { @@ -378,7 +378,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(queue: TestClientAPI.apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() if voidResponse.result.isFailure { @@ -397,7 +397,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) case is Data.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(queue: TestClientAPI.apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() if dataResponse.result.isFailure { @@ -417,7 +417,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + validatedRequest.responseData(queue: TestClientAPI.apiResponseQueue, completionHandler: { (dataResponse: DataResponse) in cleanupRequest() guard dataResponse.result.isSuccess else { diff --git a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/Extensions.swift b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/Extensions.swift index 2fa32b9e0f3..b223c143e0f 100644 --- a/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/test/swift4/default/TestClient/Classes/OpenAPIs/Extensions.swift @@ -5,7 +5,6 @@ // import Foundation -import Alamofire extension Bool: JSONEncodable { func encodeToJSON() -> Any { return self as Any } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION b/samples/openapi3/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION index c3a2c7076fa..58592f031f6 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.0-SNAPSHOT \ No newline at end of file +4.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/client.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/client.go index cdbf123bc1f..d531341577f 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/client.go @@ -17,8 +17,10 @@ import ( "errors" "fmt" "io" + "log" "mime/multipart" "net/http" + "net/http/httputil" "net/url" "os" "path/filepath" @@ -175,7 +177,27 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - return c.cfg.HTTPClient.Do(request) + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err } // ChangeBasePath changes base path to allow switching to mocks @@ -353,6 +375,9 @@ func (c *APIClient) prepareRequest( } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } if s, ok := v.(*string); ok { *s = string(b) return nil diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/configuration.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/configuration.go index 1c71df13090..04cac069b34 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/configuration.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/configuration.go @@ -10,7 +10,9 @@ package openapi import ( + "fmt" "net/http" + "strings" ) // contextKeys are used to identify the type of value in the context. @@ -49,6 +51,20 @@ type APIKey struct { Prefix string } +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + // Configuration stores the configuration of the API client type Configuration struct { BasePath string `json:"basePath,omitempty"` @@ -56,6 +72,8 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration HTTPClient *http.Client } @@ -65,6 +83,44 @@ func NewConfiguration() *Configuration { BasePath: "http://petstore.swagger.io:80/v2", DefaultHeader: make(map[string]string), UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: []ServerConfiguration{{ + Url: "http://{server}.swagger.io:{port}/v2", + Description: "petstore server", + Variables: map[string]ServerVariable{ + "server": ServerVariable{ + Description: "No description provided", + DefaultValue: "petstore", + EnumValues: []string{ + "petstore", + "qa-petstore", + "dev-petstore", + }, + }, + "port": ServerVariable{ + Description: "No description provided", + DefaultValue: "80", + EnumValues: []string{ + "80", + "8080", + }, + }, + }, + }, + Url: "https://localhost:8080/{version}", + Description: "The local server", + Variables: map[string]ServerVariable{ + "version": ServerVariable{ + Description: "No description provided", + DefaultValue: "v2", + EnumValues: []string{ + "v1", + "v2", + }, + }, + }, + }, + }, } return cfg } @@ -73,3 +129,31 @@ func NewConfiguration() *Configuration { func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} 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 4325ac24ee2..9340243f47d 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 @@ -43,7 +43,6 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli // create path and map variables localVarPath := a.client.cfg.BasePath + "/another-fake/dummy" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 8bdd8baefc6..0561d5d9fc3 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_default.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_default.go @@ -41,7 +41,6 @@ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault, // create path and map variables localVarPath := a.client.cfg.BasePath + "/foo" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 90b0090b2bb..b22a4bf9248 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go @@ -44,7 +44,6 @@ func (a *FakeApiService) FakeHealthGet(ctx _context.Context) (HealthCheckResult, // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/health" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -136,7 +135,6 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/boolean" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -233,7 +231,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/composite" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -334,7 +331,6 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/number" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -431,7 +427,6 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/outer/string" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -520,7 +515,6 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, fileSchema // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/body-with-file-schema" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -588,7 +582,6 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/body-with-query-params" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -659,7 +652,6 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, client Client) (C // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -773,7 +765,6 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -917,7 +908,6 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1028,7 +1018,6 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1105,7 +1094,6 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, re // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/inline-additionalProperties" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1173,7 +1161,6 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/jsonFormData" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -1245,7 +1232,6 @@ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/test-query-paramters" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 e8fa7e3fd9a..c27046f4ab4 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 @@ -43,7 +43,6 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake_classname_test" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 9ee468bc78c..948315ce439 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_pet.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_pet.go @@ -14,7 +14,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" "github.com/antihax/optional" "os" @@ -44,7 +43,6 @@ func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Respons // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -118,7 +116,7 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -190,7 +188,6 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/findByStatus" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -278,7 +275,6 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/findByTags" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -366,7 +362,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -463,7 +459,6 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Resp // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -539,7 +534,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -622,7 +617,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp // create path and map variables localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -734,7 +729,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i // create path and map variables localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} 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 b1080ac6d3f..2ff59f98fed 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_store.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_store.go @@ -14,7 +14,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" ) @@ -43,7 +42,7 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -111,7 +110,6 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/inventory" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -209,7 +207,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -302,7 +300,6 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order, // create path and map variables localVarPath := a.client.cfg.BasePath + "/store/order" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} 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 270cc584446..83f8f02f52b 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_user.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_user.go @@ -14,7 +14,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "fmt" "strings" ) @@ -43,7 +42,6 @@ func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp. // create path and map variables localVarPath := a.client.cfg.BasePath + "/user" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -110,7 +108,6 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user [] // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/createWithArray" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -177,7 +174,6 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []U // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/createWithList" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -245,7 +241,7 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -313,7 +309,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -401,7 +397,6 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/login" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -486,7 +481,6 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/logout" - localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} @@ -553,7 +547,7 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, user // create path and map variables localVarPath := a.client.cfg.BasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index 83da6040263..1b8eae88daa 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -17,8 +17,10 @@ import ( "errors" "fmt" "io" + "log" "mime/multipart" "net/http" + "net/http/httputil" "net/url" "os" "path/filepath" @@ -175,7 +177,28 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - return c.cfg.HTTPClient.Do(request) + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + + return resp, err } // ChangeBasePath changes base path to allow switching to mocks diff --git a/samples/openapi3/client/petstore/go/go-petstore/configuration.go b/samples/openapi3/client/petstore/go/go-petstore/configuration.go index b3b81ad0824..333de81350d 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/configuration.go +++ b/samples/openapi3/client/petstore/go/go-petstore/configuration.go @@ -10,7 +10,9 @@ package petstore import ( + "fmt" "net/http" + "strings" ) // contextKeys are used to identify the type of value in the context. @@ -49,6 +51,20 @@ type APIKey struct { Prefix string } +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + // Configuration stores the configuration of the API client type Configuration struct { BasePath string `json:"basePath,omitempty"` @@ -56,6 +72,8 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration HTTPClient *http.Client } @@ -65,6 +83,44 @@ func NewConfiguration() *Configuration { BasePath: "http://petstore.swagger.io:80/v2", DefaultHeader: make(map[string]string), UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: []ServerConfiguration{{ + Url: "http://{server}.swagger.io:{port}/v2", + Description: "petstore server", + Variables: map[string]ServerVariable{ + "server": ServerVariable{ + Description: "No description provided", + DefaultValue: "petstore", + EnumValues: []string{ + "petstore", + "qa-petstore", + "dev-petstore", + }, + }, + "port": ServerVariable{ + Description: "No description provided", + DefaultValue: "80", + EnumValues: []string{ + "80", + "8080", + }, + }, + }, + }, + Url: "https://localhost:8080/{version}", + Description: "The local server", + Variables: map[string]ServerVariable{ + "version": ServerVariable{ + Description: "No description provided", + DefaultValue: "v2", + EnumValues: []string{ + "v1", + "v2", + }, + }, + }, + }, + }, } return cfg } @@ -73,3 +129,31 @@ func NewConfiguration() *Configuration { func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index 89234f99db5..723066b465f 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -156,7 +156,7 @@ class AnotherFakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -181,7 +181,7 @@ class AnotherFakeApi if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -196,7 +196,7 @@ class AnotherFakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -263,7 +263,7 @@ class AnotherFakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index 7e5aef30bcb..89edbd6fcab 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -150,7 +150,7 @@ class DefaultApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -175,7 +175,7 @@ class DefaultApi if ('\OpenAPI\Client\Model\InlineResponseDefault' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -190,7 +190,7 @@ class DefaultApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -255,7 +255,7 @@ class DefaultApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 3928e943fe2..2a42afbae7f 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -154,7 +154,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -179,7 +179,7 @@ class FakeApi if ('\OpenAPI\Client\Model\HealthCheckResult' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -194,7 +194,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -259,7 +259,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -405,7 +405,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -430,7 +430,7 @@ class FakeApi if ('bool' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -445,7 +445,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -512,7 +512,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -662,7 +662,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -687,7 +687,7 @@ class FakeApi if ('\OpenAPI\Client\Model\OuterComposite' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -702,7 +702,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -769,7 +769,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -919,7 +919,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -944,7 +944,7 @@ class FakeApi if ('float' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -959,7 +959,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1026,7 +1026,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1176,7 +1176,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1201,7 +1201,7 @@ class FakeApi if ('string' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1216,7 +1216,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1283,7 +1283,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1432,7 +1432,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1649,7 +1649,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1882,7 +1882,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1907,7 +1907,7 @@ class FakeApi if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1922,7 +1922,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1989,7 +1989,7 @@ class FakeApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2174,7 +2174,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -2569,7 +2569,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -2852,7 +2852,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -3137,7 +3137,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -3358,7 +3358,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -3595,7 +3595,7 @@ class FakeApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index 337af48cc0b..ebc1b5dbc8e 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -156,7 +156,7 @@ class FakeClassnameTags123Api "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -181,7 +181,7 @@ class FakeClassnameTags123Api if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -196,7 +196,7 @@ class FakeClassnameTags123Api if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -263,7 +263,7 @@ class FakeClassnameTags123Api if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 9229fefbb5c..44409e5b18c 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -163,7 +163,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -406,7 +406,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -642,7 +642,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -667,7 +667,7 @@ class PetApi if ('\OpenAPI\Client\Model\Pet[]' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -682,7 +682,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -749,7 +749,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -917,7 +917,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -942,7 +942,7 @@ class PetApi if ('\OpenAPI\Client\Model\Pet[]' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -957,7 +957,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1024,7 +1024,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1192,7 +1192,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1217,7 +1217,7 @@ class PetApi if ('\OpenAPI\Client\Model\Pet' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1232,7 +1232,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1299,7 +1299,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1476,7 +1476,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1721,7 +1721,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1968,7 +1968,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1993,7 +1993,7 @@ class PetApi if ('\OpenAPI\Client\Model\ApiResponse' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2008,7 +2008,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2079,7 +2079,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2263,7 +2263,7 @@ class PetApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -2288,7 +2288,7 @@ class PetApi if ('\OpenAPI\Client\Model\ApiResponse' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2303,7 +2303,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -2374,7 +2374,7 @@ class PetApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index 48496d82dbd..928a063a045 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -155,7 +155,7 @@ class StoreApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -378,7 +378,7 @@ class StoreApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -403,7 +403,7 @@ class StoreApi if ('map[string,int]' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -418,7 +418,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -483,7 +483,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -638,7 +638,7 @@ class StoreApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -663,7 +663,7 @@ class StoreApi if ('\OpenAPI\Client\Model\Order' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -678,7 +678,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -745,7 +745,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -917,7 +917,7 @@ class StoreApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -942,7 +942,7 @@ class StoreApi if ('\OpenAPI\Client\Model\Order' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -957,7 +957,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1024,7 +1024,7 @@ class StoreApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index edaa1d2b8b5..c5103a1dbf2 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -155,7 +155,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -374,7 +374,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -593,7 +593,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -812,7 +812,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1037,7 +1037,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1062,7 +1062,7 @@ class UserApi if ('\OpenAPI\Client\Model\User' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1077,7 +1077,7 @@ class UserApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1144,7 +1144,7 @@ class UserApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1311,7 +1311,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1336,7 +1336,7 @@ class UserApi if ('string' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1351,7 +1351,7 @@ class UserApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1420,7 +1420,7 @@ class UserApi if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $responseBody; } return [ @@ -1589,7 +1589,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } @@ -1798,7 +1798,7 @@ class UserApi "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } diff --git a/samples/openapi3/client/petstore/python/.travis.yml b/samples/openapi3/client/petstore/python/.travis.yml index 86211e2d4a2..388de83128f 100644 --- a/samples/openapi3/client/petstore/python/.travis.yml +++ b/samples/openapi3/client/petstore/python/.travis.yml @@ -6,8 +6,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb index 936405f68a3..a98fb5c45bd 100644 --- a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb +++ b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb @@ -235,7 +235,7 @@ module Petstore description: "petstore server", variables: { server: { - description: "No descriptoin provided", + description: "No description provided", default_value: "petstore", enum_values: [ "petstore", @@ -244,7 +244,7 @@ module Petstore ] }, port: { - description: "No descriptoin provided", + description: "No description provided", default_value: "80", enum_values: [ "80", @@ -258,7 +258,7 @@ module Petstore description: "The local server", variables: { version: { - description: "No descriptoin provided", + description: "No description provided", default_value: "v2", enum_values: [ "v1", diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/configuration.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/configuration.rb index 938c3b1c062..75e3e441f4f 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/configuration.rb @@ -240,7 +240,7 @@ module Petstore description: "petstore server", variables: { server: { - description: "No descriptoin provided", + description: "No description provided", default_value: "petstore", enum_values: [ "petstore", @@ -249,7 +249,7 @@ module Petstore ] }, port: { - description: "No descriptoin provided", + description: "No description provided", default_value: "80", enum_values: [ "80", @@ -263,7 +263,7 @@ module Petstore description: "The local server", variables: { version: { - description: "No descriptoin provided", + description: "No description provided", default_value: "v2", enum_values: [ "v1", diff --git a/samples/openapi3/server/petstore/python-flask-python2/.openapi-generator/VERSION b/samples/openapi3/server/petstore/python-flask-python2/.openapi-generator/VERSION index c3a2c7076fa..58592f031f6 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/.openapi-generator/VERSION +++ b/samples/openapi3/server/petstore/python-flask-python2/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.0-SNAPSHOT \ No newline at end of file +4.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask-python2/.travis.yml b/samples/openapi3/server/petstore/python-flask-python2/.travis.yml index 86211e2d4a2..388de83128f 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/.travis.yml +++ b/samples/openapi3/server/petstore/python-flask-python2/.travis.yml @@ -6,8 +6,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/samples/openapi3/server/petstore/python-flask/.openapi-generator/VERSION b/samples/openapi3/server/petstore/python-flask/.openapi-generator/VERSION index c3a2c7076fa..58592f031f6 100644 --- a/samples/openapi3/server/petstore/python-flask/.openapi-generator/VERSION +++ b/samples/openapi3/server/petstore/python-flask/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.0-SNAPSHOT \ No newline at end of file +4.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask/.travis.yml b/samples/openapi3/server/petstore/python-flask/.travis.yml index dd6c4450aa9..ad71ee5ca08 100644 --- a/samples/openapi3/server/petstore/python-flask/.travis.yml +++ b/samples/openapi3/server/petstore/python-flask/.travis.yml @@ -5,8 +5,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION index d168f1d8bda..e4955748d3e 100644 --- a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION +++ b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.1-SNAPSHOT \ No newline at end of file +4.2.2-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/go-api-server/go.mod b/samples/server/petstore/go-api-server/go.mod new file mode 100644 index 00000000000..5b6a67c74e2 --- /dev/null +++ b/samples/server/petstore/go-api-server/go.mod @@ -0,0 +1,5 @@ +module github.com/GIT_USER_ID/GIT_REPO_ID + +go 1.13 + +require github.com/gorilla/mux v1.7.3 diff --git a/samples/server/petstore/go-api-server/main.go b/samples/server/petstore/go-api-server/main.go index f8b3e76d13c..ddc5258297c 100644 --- a/samples/server/petstore/go-api-server/main.go +++ b/samples/server/petstore/go-api-server/main.go @@ -13,14 +13,7 @@ import ( "log" "net/http" - // WARNING! - // Change this to a fully-qualified import path - // once you place this file into your project. - // For example, - // - // sw "github.com/myname/myrepo/go" - // - petstoreserver "./go" + petstoreserver "github.com/GIT_USER_ID/GIT_REPO_ID/go" ) func main() { diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator-ignore b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/.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-modelMutable/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION new file mode 100644 index 00000000000..d168f1d8bda --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.2.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/README.md b/samples/server/petstore/kotlin-springboot-modelMutable/README.md new file mode 100644 index 00000000000..b6865a08113 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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-modelMutable/build.gradle.kts b/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts new file mode 100644 index 00000000000..26f4601e570 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts @@ -0,0 +1,54 @@ +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-web") + 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") + } +} + +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-modelMutable/pom.xml b/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml new file mode 100644 index 00000000000..38491e8939c --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml @@ -0,0 +1,153 @@ + + 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-web + + + + io.swagger + swagger-annotations + 1.5.21 + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + 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-modelMutable/settings.gradle b/samples/server/petstore/kotlin-springboot-modelMutable/settings.gradle new file mode 100644 index 00000000000..e9bd5d32d7c --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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-modelMutable/src/main/kotlin/org/openapitools/Application.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/Application.kt new file mode 100644 index 00000000000..f2ee49d476b --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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-modelMutable/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/Exceptions.kt new file mode 100644 index 00000000000..4d8400902aa --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/Exceptions.kt @@ -0,0 +1,29 @@ +package org.openapitools.api + +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.ControllerAdvice +import org.springframework.web.bind.annotation.ExceptionHandler +import javax.servlet.http.HttpServletResponse +import javax.validation.ConstraintViolationException + +// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception +sealed class ApiException(msg: String, val code: Int) : Exception(msg) + +class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code) + + +@ControllerAdvice +class DefaultExceptionHandler { + + @ExceptionHandler(value = [ApiException::class]) + fun onApiException(ex: ApiException, response: HttpServletResponse): Unit = + response.sendError(ex.code, ex.message) + + @ExceptionHandler(value = [NotImplementedError::class]) + fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.NOT_IMPLEMENTED.value()) + + @ExceptionHandler(value = [ConstraintViolationException::class]) + fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message }) +} diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt new file mode 100644 index 00000000000..b500f915568 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -0,0 +1,184 @@ +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 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]) + 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]) + 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]) + 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]) + 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]) + 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]) + 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-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt new file mode 100644 index 00000000000..f3f2fd68b6c --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -0,0 +1,22 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +interface PetApiService { + + fun addPet(body: Pet): Unit + + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit + + fun findPetsByStatus(status: kotlin.collections.List): List + + fun findPetsByTags(tags: kotlin.collections.List): List + + fun getPetById(petId: kotlin.Long): Pet + + fun updatePet(body: Pet): Unit + + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit + + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse +} diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt new file mode 100644 index 00000000000..452e4e400b7 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -0,0 +1,40 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import org.springframework.stereotype.Service +@Service +class PetApiServiceImpl : PetApiService { + + override fun addPet(body: Pet): Unit { + TODO("Implement me") + } + + override fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit { + TODO("Implement me") + } + + override fun findPetsByStatus(status: kotlin.collections.List): List { + TODO("Implement me") + } + + override fun findPetsByTags(tags: kotlin.collections.List): List { + TODO("Implement me") + } + + override fun getPetById(petId: kotlin.Long): Pet { + TODO("Implement me") + } + + override fun updatePet(body: Pet): Unit { + TODO("Implement me") + } + + override fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit { + TODO("Implement me") + } + + 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-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt new file mode 100644 index 00000000000..71017e33a50 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -0,0 +1,107 @@ +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 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]) + 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]) + 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]) + 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]) + 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-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiService.kt new file mode 100644 index 00000000000..d4a4ef9507f --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -0,0 +1,13 @@ +package org.openapitools.api + +import org.openapitools.model.Order +interface StoreApiService { + + fun deleteOrder(orderId: kotlin.String): Unit + + fun getInventory(): Map + + fun getOrderById(orderId: kotlin.Long): Order + + fun placeOrder(body: Order): Order +} diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt new file mode 100644 index 00000000000..7e733e28dc5 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -0,0 +1,23 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import org.springframework.stereotype.Service +@Service +class StoreApiServiceImpl : StoreApiService { + + override fun deleteOrder(orderId: kotlin.String): Unit { + TODO("Implement me") + } + + override fun getInventory(): Map { + TODO("Implement me") + } + + override fun getOrderById(orderId: kotlin.Long): Order { + TODO("Implement me") + } + + override fun placeOrder(body: Order): Order { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt new file mode 100644 index 00000000000..1dbc304d88e --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -0,0 +1,161 @@ +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 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]) + 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]) + fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List +): 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]) + fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List +): 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]) + 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]) + 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]) + 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]) + 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]) + 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-modelMutable/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiService.kt new file mode 100644 index 00000000000..491705c3b50 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -0,0 +1,21 @@ +package org.openapitools.api + +import org.openapitools.model.User +interface UserApiService { + + fun createUser(body: User): Unit + + fun createUsersWithArrayInput(body: kotlin.collections.List): Unit + + fun createUsersWithListInput(body: kotlin.collections.List): Unit + + fun deleteUser(username: kotlin.String): Unit + + fun getUserByName(username: kotlin.String): User + + fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String + + fun logoutUser(): Unit + + fun updateUser(username: kotlin.String, body: User): Unit +} diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt new file mode 100644 index 00000000000..ebd82222015 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -0,0 +1,39 @@ +package org.openapitools.api + +import org.openapitools.model.User +import org.springframework.stereotype.Service +@Service +class UserApiServiceImpl : UserApiService { + + override fun createUser(body: User): Unit { + TODO("Implement me") + } + + override fun createUsersWithArrayInput(body: kotlin.collections.List): Unit { + TODO("Implement me") + } + + override fun createUsersWithListInput(body: kotlin.collections.List): Unit { + TODO("Implement me") + } + + override fun deleteUser(username: kotlin.String): Unit { + TODO("Implement me") + } + + override fun getUserByName(username: kotlin.String): User { + TODO("Implement me") + } + + override fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String { + TODO("Implement me") + } + + override fun logoutUser(): Unit { + TODO("Implement me") + } + + override fun updateUser(username: kotlin.String, body: User): Unit { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt new file mode 100644 index 00000000000..74e95802723 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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") var id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") var name: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt new file mode 100644 index 00000000000..a121d4abe1d --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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") var code: kotlin.Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("type") var type: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("message") var message: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 00000000000..5ed9ea53497 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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") var id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("petId") var petId: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("quantity") var quantity: kotlin.Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("shipDate") var shipDate: java.time.OffsetDateTime? = null, + + @ApiModelProperty(example = "null", value = "Order Status") + @JsonProperty("status") var status: Order.Status? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("complete") var 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-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt new file mode 100644 index 00000000000..f0ff8c00c1d --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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") var name: kotlin.String, + + @get:NotNull + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("photoUrls") var photoUrls: kotlin.collections.List, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") var id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("category") var category: Category? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("tags") var tags: kotlin.collections.List? = null, + + @ApiModelProperty(example = "null", value = "pet status in the store") + @JsonProperty("status") var 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-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt new file mode 100644 index 00000000000..3997d00edbe --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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") var id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") var name: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 00000000000..011d28b1cdb --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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") var id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("username") var username: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("firstName") var firstName: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("lastName") var lastName: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("email") var email: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("password") var password: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("phone") var phone: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "User Status") + @JsonProperty("userStatus") var userStatus: kotlin.Int? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/resources/application.yaml b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/resources/application.yaml new file mode 100644 index 00000000000..8e2ebcde976 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/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-modelMutable/src/test/kotlin/org/openapitools/api/PetApiTest.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/PetApiTest.kt new file mode 100644 index 00000000000..d621c166966 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/PetApiTest.kt @@ -0,0 +1,148 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import org.junit.jupiter.api.Test + +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() { + 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() { + 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() { + 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() { + 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() { + 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() { + 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() { + 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() { + 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-modelMutable/src/test/kotlin/org/openapitools/api/StoreApiTest.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/StoreApiTest.kt new file mode 100644 index 00000000000..82b91cd652b --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/StoreApiTest.kt @@ -0,0 +1,77 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import org.junit.jupiter.api.Test + +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() { + 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() { + 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() { + 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() { + val body:Order? = null + val response: ResponseEntity = api.placeOrder(body!!) + + // TODO: test validations + } + +} diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/UserApiTest.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/UserApiTest.kt new file mode 100644 index 00000000000..14917f70aeb --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/UserApiTest.kt @@ -0,0 +1,143 @@ +package org.openapitools.api + +import org.openapitools.model.User +import org.junit.jupiter.api.Test + +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() { + 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() { + 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() { + 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() { + 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() { + 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() { + 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() { + 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() { + 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/php-slim4/composer.json b/samples/server/petstore/php-slim4/composer.json index cc3c4ef754a..3a82d6db53f 100644 --- a/samples/server/petstore/php-slim4/composer.json +++ b/samples/server/petstore/php-slim4/composer.json @@ -15,7 +15,7 @@ "require-dev": { "phpunit/phpunit": "^6.0 || ^7.0", "overtrue/phplint": "^1.0", - "squizlabs/php_codesniffer": "^3.0" + "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "psr-4": { "OpenAPIServer\\": [ diff --git a/samples/server/petstore/php-slim4/composer.lock b/samples/server/petstore/php-slim4/composer.lock new file mode 100644 index 00000000000..350f44d6feb --- /dev/null +++ b/samples/server/petstore/php-slim4/composer.lock @@ -0,0 +1,2626 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "c45e90198360fe632369c0cc2e9e6523", + "packages": [ + { + "name": "dyorg/slim-token-authentication", + "version": "dev-slim4", + "source": { + "type": "git", + "url": "https://github.com/ybelenko/slim-token-authentication.git", + "reference": "87c64d370922c492188d2a782b23609341199259" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ybelenko/slim-token-authentication/zipball/87c64d370922c492188d2a782b23609341199259", + "reference": "87c64d370922c492188d2a782b23609341199259", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "equip/dispatch": "^2.0", + "phpunit/phpunit": "^6.5", + "slim/psr7": "^0.4.0", + "slim/slim": "^4.0", + "squizlabs/php_codesniffer": "~2.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dyorg\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Dyorg\\": "tests", + "Dyorg\\TokenAuthentication\\Example\\": "example" + } + }, + "scripts": { + "test": [ + "phpunit" + ] + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dyorg Almeida", + "email": "dyorg@rabbiit.com", + "homepage": "https://rabbiit.com/", + "role": "Developer" + } + ], + "description": "Slim 4.0+ Token Authentication Middleware", + "homepage": "https://github.com/dyorg/slim-token-authentication", + "keywords": [ + "auth", + "authentication", + "authorization", + "middleware", + "slim", + "token" + ], + "support": { + "source": "https://github.com/ybelenko/slim-token-authentication/tree/slim4" + }, + "time": "2019-08-11T03:59:16+00:00" + }, + { + "name": "fig/http-message-util", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message-util.git", + "reference": "35b19404371b31b3a43823c755398c48c9966db4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/35b19404371b31b3a43823c755398c48c9966db4", + "reference": "35b19404371b31b3a43823c755398c48c9966db4", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2018-11-19T16:19:58+00:00" + }, + { + "name": "nikic/fast-route", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "FastRoute\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "time": "2018-02-13T20:26:39+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "time": "2019-04-30T12:38:16+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/http-server-handler", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-handler.git", + "reference": "aff2f80e33b7f026ec96bb42f63242dc50ffcae7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/aff2f80e33b7f026ec96bb42f63242dc50ffcae7", + "reference": "aff2f80e33b7f026ec96bb42f63242dc50ffcae7", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side request handler", + "keywords": [ + "handler", + "http", + "http-interop", + "psr", + "psr-15", + "psr-7", + "request", + "response", + "server" + ], + "time": "2018-10-30T16:46:14+00:00" + }, + { + "name": "psr/http-server-middleware", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-middleware.git", + "reference": "2296f45510945530b9dceb8bcedb5cb84d40c5f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/2296f45510945530b9dceb8bcedb5cb84d40c5f5", + "reference": "2296f45510945530b9dceb8bcedb5cb84d40c5f5", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0", + "psr/http-server-handler": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side middleware", + "keywords": [ + "http", + "http-interop", + "middleware", + "psr", + "psr-15", + "psr-7", + "request", + "response" + ], + "time": "2018-10-30T17:12:04+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2016-02-11T07:05:27+00:00" + }, + { + "name": "slim/psr7", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim-Psr7.git", + "reference": "d312896b7cd4aca7d4b86b64acdfcb5cc3da758f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/d312896b7cd4aca7d4b86b64acdfcb5cc3da758f", + "reference": "d312896b7cd4aca7d4b86b64acdfcb5cc3da758f", + "shasum": "" + }, + "require": { + "fig/http-message-util": "^1.1", + "php": "^7.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^2" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-json": "*", + "http-interop/http-factory-tests": "^0.5.0", + "php-http/psr7-integration-tests": "dev-master", + "phpstan/phpstan": "^0.10", + "phpunit/phpunit": "^6.0|^7.0", + "squizlabs/php_codesniffer": "^3.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\Psr7\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "http://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + } + ], + "description": "Strict PSR-7 implementation", + "homepage": "https://www.slimframework.com", + "keywords": [ + "http", + "psr-7", + "psr7" + ], + "time": "2019-08-02T17:06:08+00:00" + }, + { + "name": "slim/slim", + "version": "4.3.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "26020e9a099e69b0b12918115894f7106364dcb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/26020e9a099e69b0b12918115894f7106364dcb7", + "reference": "26020e9a099e69b0b12918115894f7106364dcb7", + "shasum": "" + }, + "require": { + "ext-json": "*", + "nikic/fast-route": "^1.3", + "php": "^7.1", + "psr/container": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "psr/http-server-handler": "^1.0", + "psr/http-server-middleware": "^1.0" + }, + "require-dev": { + "ext-simplexml": "*", + "guzzlehttp/psr7": "^1.5", + "http-interop/http-factory-guzzle": "^1.0", + "nyholm/psr7": "^1.1", + "nyholm/psr7-server": "^0.3.0", + "phpspec/prophecy": "^1.8", + "phpstan/phpstan": "^0.11.5", + "phpunit/phpunit": "^7.5", + "slim/http": "^0.7", + "slim/psr7": "^0.3", + "squizlabs/php_codesniffer": "^3.4.2", + "zendframework/zend-diactoros": "^2.1" + }, + "suggest": { + "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", + "ext-xml": "Needed to support XML format in BodyParsingMiddleware", + "slim/psr7": "Slim PSR-7 implementation. See http://www.slimframework.com/docs/v4/start/installation.html for more information." + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\": "Slim", + "Slim\\Tests\\": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" + } + ], + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "homepage": "https://www.slimframework.com", + "keywords": [ + "api", + "framework", + "micro", + "router" + ], + "time": "2019-10-05T21:24:58+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2019-10-21T16:45:58+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.9.3", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2019-08-09T12:45:53+00:00" + }, + { + "name": "overtrue/phplint", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/overtrue/phplint.git", + "reference": "deaee8c3459087ea5d17031206b8722a96dd330b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/overtrue/phplint/zipball/deaee8c3459087ea5d17031206b8722a96dd330b", + "reference": "deaee8c3459087ea5d17031206b8722a96dd330b", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.5.9", + "symfony/console": "^3.2|^4.0|^5.0", + "symfony/finder": "^3.0|^4.0|^5.0", + "symfony/process": "^3.0|^4.0|^5.0", + "symfony/yaml": "^3.0|^4.0|^5.0" + }, + "require-dev": { + "jakub-onderka/php-console-highlighter": "^0.3.2 || ^0.4" + }, + "bin": [ + "bin/phplint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Overtrue\\PHPLint\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "overtrue", + "email": "anzhengchao@gmail.com" + } + ], + "description": "a php syntax check tool.", + "keywords": [ + "check", + "lint", + "phplint", + "syntax" + ], + "time": "2019-12-07T13:46:15+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "~6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2018-08-07T13:53:10+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", + "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "^1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2019-09-12T14:27:41+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "shasum": "" + }, + "require": { + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2019-08-22T18:11:29+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.9.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2019-10-03T11:07:50+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2018-09-13T20:33:42+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2019-06-07T04:22:29+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2019-09-17T06:23:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.18", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fcf6c4bfafaadc07785528b06385cce88935474d", + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2019-12-06T05:14:37+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2019-02-04T06:01:07+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2019-11-20T08:46:58+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2019-09-14T09:02:43+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.5.3", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", + "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2019-12-04T04:46:47+00:00" + }, + { + "name": "symfony/console", + "version": "v5.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "dae5ef273d700771168ab889d9f8a19b2d206656" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/dae5ef273d700771168ab889d9f8a19b2d206656", + "reference": "dae5ef273d700771168ab889d9f8a19b2d206656", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "symfony/dependency-injection": "<4.4", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2019-12-01T10:51:15+00:00" + }, + { + "name": "symfony/finder", + "version": "v5.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "17874dd8ab9a19422028ad56172fb294287a701b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/17874dd8ab9a19422028ad56172fb294287a701b", + "reference": "17874dd8ab9a19422028ad56172fb294287a701b", + "shasum": "" + }, + "require": { + "php": "^7.2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2019-11-18T17:27:11+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T14:18:11+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T16:25:15+00:00" + }, + { + "name": "symfony/process", + "version": "v5.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "1568a2e8370fbc7416ef64eb5a698e4a05db5ff4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/1568a2e8370fbc7416ef64eb5a698e4a05db5ff4", + "reference": "1568a2e8370fbc7416ef64eb5a698e4a05db5ff4", + "shasum": "" + }, + "require": { + "php": "^7.2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2019-11-28T14:20:16+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "144c5e51266b281231e947b51223ba14acf1a749" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-11-18T17:27:11+00:00" + }, + { + "name": "symfony/yaml", + "version": "v5.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "51b684480184fa767b97e28eaca67664e48dd3e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/51b684480184fa767b97e28eaca67664e48dd3e9", + "reference": "51b684480184fa767b97e28eaca67664e48dd3e9", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<4.4" + }, + "require-dev": { + "symfony/console": "^4.4|^5.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2019-11-18T17:27:11+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-06-13T22:48:21+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2019-11-24T13:36:37+00:00" + } + ], + "aliases": [], + "minimum-stability": "RC", + "stability-flags": { + "dyorg/slim-token-authentication": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.1" + }, + "platform-dev": [] +} diff --git a/samples/server/petstore/php-slim4/index.php b/samples/server/petstore/php-slim4/index.php index 6a2dfac0973..70cb6dede1a 100644 --- a/samples/server/petstore/php-slim4/index.php +++ b/samples/server/petstore/php-slim4/index.php @@ -1,4 +1,5 @@ > testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + default CompletableFuture> testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return CompletableFuture.completedFuture(new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED)); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -193,6 +285,18 @@ public interface FakeApi { } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -204,6 +308,12 @@ public interface FakeApi { } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -216,6 +326,13 @@ public interface FakeApi { } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -228,6 +345,17 @@ public interface FakeApi { } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -239,6 +367,14 @@ public interface FakeApi { } + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -251,7 +387,7 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default CompletableFuture> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + default CompletableFuture> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { return CompletableFuture.supplyAsync(()-> { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 1e66e8d07f9..4b9166a4087 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -36,6 +36,13 @@ public interface FakeClassnameTestApi { return Optional.empty(); } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java index 2191016fc6f..58c2d72cdc0 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java @@ -38,6 +38,13 @@ public interface PetApi { return Optional.empty(); } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -56,6 +63,14 @@ public interface PetApi { } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -73,6 +88,14 @@ public interface PetApi { } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -107,6 +130,15 @@ public interface PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -141,6 +173,15 @@ public interface PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -173,6 +214,15 @@ public interface PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -193,6 +243,14 @@ public interface PetApi { } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -210,6 +268,14 @@ public interface PetApi { } + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -222,7 +288,7 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default CompletableFuture> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + default CompletableFuture> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { return CompletableFuture.supplyAsync(()-> { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/StoreApi.java index ec86eeff588..593d9b3ee1a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/StoreApi.java @@ -37,6 +37,14 @@ public interface StoreApi { return Optional.empty(); } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -49,6 +57,12 @@ public interface StoreApi { } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -63,6 +77,15 @@ public interface StoreApi { } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -93,6 +116,13 @@ public interface StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java index 6b35da01508..22fad7792fd 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java @@ -37,6 +37,13 @@ public interface UserApi { return Optional.empty(); } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -48,6 +55,12 @@ public interface UserApi { } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -59,6 +72,12 @@ public interface UserApi { } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -70,6 +89,14 @@ public interface UserApi { } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -82,6 +109,14 @@ public interface UserApi { } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -112,6 +147,14 @@ public interface UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -125,6 +168,11 @@ public interface UserApi { } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -136,6 +184,15 @@ public interface UserApi { } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/AnotherFakeApi.java index d38de995bd4..3a3e7419b11 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -35,6 +35,13 @@ public interface AnotherFakeApi { return Optional.empty(); } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeApi.java index 1bc39492a46..fd7f99f0914 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeApi.java @@ -45,6 +45,13 @@ public interface FakeApi { return Optional.empty(); } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -57,6 +64,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) @@ -69,6 +83,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) @@ -90,6 +111,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) @@ -102,6 +130,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string", response = String.class) }) @@ -114,6 +149,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -126,6 +168,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -138,6 +187,13 @@ public interface FakeApi { } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -160,6 +216,27 @@ public interface FakeApi { } + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake", }) @@ -169,12 +246,27 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) LocalDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) LocalDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -188,6 +280,18 @@ public interface FakeApi { } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -199,6 +303,12 @@ public interface FakeApi { } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -211,6 +321,13 @@ public interface FakeApi { } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -223,6 +340,17 @@ public interface FakeApi { } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -234,6 +362,14 @@ public interface FakeApi { } + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -246,7 +382,7 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 4e909df0825..cc5266e4cf0 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -35,6 +35,13 @@ public interface FakeClassnameTestApi { return Optional.empty(); } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java index 27872a7f2d7..186fddfb090 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java @@ -37,6 +37,13 @@ public interface PetApi { return Optional.empty(); } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -55,6 +62,14 @@ public interface PetApi { } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -72,6 +87,14 @@ public interface PetApi { } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -104,6 +127,15 @@ public interface PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -136,6 +168,15 @@ public interface PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -166,6 +207,15 @@ public interface PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -186,6 +236,14 @@ public interface PetApi { } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -203,6 +261,14 @@ public interface PetApi { } + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -215,7 +281,7 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/StoreApi.java index 1838f04257e..88f857d3eb7 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/StoreApi.java @@ -36,6 +36,14 @@ public interface StoreApi { return Optional.empty(); } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -48,6 +56,12 @@ public interface StoreApi { } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -62,6 +76,15 @@ public interface StoreApi { } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -90,6 +113,13 @@ public interface StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java index bb6ed796e7b..96b0f11ac16 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java @@ -36,6 +36,13 @@ public interface UserApi { return Optional.empty(); } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -47,6 +54,12 @@ public interface UserApi { } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -58,6 +71,12 @@ public interface UserApi { } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -69,6 +88,14 @@ public interface UserApi { } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -81,6 +108,14 @@ public interface UserApi { } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -109,6 +144,14 @@ public interface UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -122,6 +165,11 @@ public interface UserApi { } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -133,6 +181,15 @@ public interface UserApi { } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApi.java index a7e416f15a6..309f8a53f4d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -27,6 +27,13 @@ import java.util.Map; @Api(value = "another-fake", description = "the another-fake API") public interface AnotherFakeApi { + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApiController.java index fb922708cb0..d6132e093cf 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApiController.java @@ -31,6 +31,14 @@ public class AnotherFakeApiController implements AnotherFakeApi { this.request = request; } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + * @see AnotherFakeApi#call123testSpecialTags + */ public ResponseEntity call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApi.java index 56d21638b37..3a28feb37c3 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApi.java @@ -37,6 +37,13 @@ import java.util.Map; @Api(value = "fake", description = "the fake API") public interface FakeApi { + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -46,6 +53,13 @@ public interface FakeApi { ResponseEntity createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem); + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) @@ -55,6 +69,13 @@ public interface FakeApi { ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body); + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) @@ -64,6 +85,13 @@ public interface FakeApi { ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body); + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) @@ -73,6 +101,13 @@ public interface FakeApi { ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body); + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string", response = String.class) }) @@ -82,6 +117,13 @@ public interface FakeApi { ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body); + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -91,6 +133,13 @@ public interface FakeApi { ResponseEntity testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body); + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -100,6 +149,13 @@ public interface FakeApi { ResponseEntity testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body); + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -110,6 +166,27 @@ public interface FakeApi { ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake", }) @@ -119,9 +196,24 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback); + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -132,6 +224,18 @@ public interface FakeApi { ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestParam(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestParam(value="enum_form_string", required=false) String enumFormString); + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -140,6 +244,12 @@ public interface FakeApi { ResponseEntity testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group); + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -149,6 +259,13 @@ public interface FakeApi { ResponseEntity testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map param); + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -158,6 +275,17 @@ public interface FakeApi { ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true) @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true) @RequestParam(value="param2", required=true) String param2); + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -166,6 +294,14 @@ public interface FakeApi { ResponseEntity testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List context); + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -178,6 +314,6 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata); + ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApiController.java index 1778cc30e75..aac6a3e3b1d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApiController.java @@ -41,16 +41,40 @@ public class FakeApiController implements FakeApi { this.request = request; } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + * @see FakeApi#createXmlItem + */ public ResponseEntity createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + * @see FakeApi#fakeOuterBooleanSerialize + */ public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + * @see FakeApi#fakeOuterCompositeSerialize + */ public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { @@ -63,26 +87,66 @@ public class FakeApiController implements FakeApi { } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + * @see FakeApi#fakeOuterNumberSerialize + */ public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + * @see FakeApi#fakeOuterStringSerialize + */ public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + * @see FakeApi#testBodyWithFileSchema + */ public ResponseEntity testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + * @see FakeApi#testBodyWithQueryParams + */ public ResponseEntity testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + * @see FakeApi#testClientModel + */ public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -95,37 +159,124 @@ public class FakeApiController implements FakeApi { } - public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see FakeApi#testEndpointParameters + */ + public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + * @see FakeApi#testEnumParameters + */ public ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestParam(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestParam(value="enum_form_string", required=false) String enumFormString) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + * @see FakeApi#testGroupParameters + */ public ResponseEntity testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + * @see FakeApi#testInlineAdditionalProperties + */ public ResponseEntity testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map param) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + * @see FakeApi#testJsonFormData + */ public ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true) @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true) @RequestParam(value="param2", required=true) String param2) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + * @see FakeApi#testQueryParameterCollectionFormat + */ public ResponseEntity testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List context) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } - public ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + * @see FakeApi#uploadFileWithRequiredFile + */ + public ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }"; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 4973979dc19..396f5e8be71 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -27,6 +27,13 @@ import java.util.Map; @Api(value = "fake_classname_test", description = "the fake_classname_test API") public interface FakeClassnameTestApi { + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java index d2642a4ceeb..95e67da6ac0 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java @@ -31,6 +31,14 @@ public class FakeClassnameTestApiController implements FakeClassnameTestApi { this.request = request; } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + * @see FakeClassnameTestApi#testClassname + */ public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApi.java index 8c386ce6d16..ac0da6bc88c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApi.java @@ -29,6 +29,13 @@ import java.util.Map; @Api(value = "pet", description = "the pet API") public interface PetApi { + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -44,6 +51,14 @@ public interface PetApi { ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -58,6 +73,14 @@ public interface PetApi { ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -73,6 +96,15 @@ public interface PetApi { ResponseEntity> 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) List status); + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -88,6 +120,15 @@ public interface PetApi { ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -101,6 +142,15 @@ public interface PetApi { ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId); + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -118,6 +168,14 @@ public interface PetApi { ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -132,6 +190,14 @@ public interface PetApi { ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) String status); + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -144,6 +210,6 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file); + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java index b1e82a3f737..ee5e3d0e13b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java @@ -33,16 +33,42 @@ public class PetApiController implements PetApi { this.request = request; } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + * @see PetApi#addPet + */ public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + * @see PetApi#deletePet + */ public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 400) + * @see PetApi#findPetsByStatus + */ public ResponseEntity> 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) List status) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -60,6 +86,16 @@ public class PetApiController implements PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + * @see PetApi#findPetsByTags + */ public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -77,6 +113,16 @@ public class PetApiController implements PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * @see PetApi#getPetById + */ public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -94,17 +140,45 @@ public class PetApiController implements PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + * @see PetApi#updatePet + */ public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + * @see PetApi#updatePetWithForm + */ public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) String status) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } - public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + * @see PetApi#uploadFile + */ + public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }"; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApi.java index af2ec901102..b9366f2720c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApi.java @@ -28,6 +28,14 @@ import java.util.Map; @Api(value = "store", description = "the store API") public interface StoreApi { + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -37,6 +45,12 @@ public interface StoreApi { ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId); + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -48,6 +62,15 @@ public interface StoreApi { ResponseEntity> getInventory(); + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -59,6 +82,13 @@ public interface StoreApi { ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId); + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApiController.java index 63aa57e3c02..01c442d087c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApiController.java @@ -32,16 +32,42 @@ public class StoreApiController implements StoreApi { this.request = request; } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + * @see StoreApi#deleteOrder + */ public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + * @see StoreApi#getInventory + */ public ResponseEntity> getInventory() { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + * @see StoreApi#getOrderById + */ public ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -59,6 +85,14 @@ public class StoreApiController implements StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + * @see StoreApi#placeOrder + */ public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApi.java index 53236596909..388e3cd0985 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApi.java @@ -28,6 +28,13 @@ import java.util.Map; @Api(value = "user", description = "the user API") public interface UserApi { + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -36,6 +43,12 @@ public interface UserApi { ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -44,6 +57,12 @@ public interface UserApi { ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -52,6 +71,14 @@ public interface UserApi { ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -61,6 +88,14 @@ public interface UserApi { ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username); + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -72,6 +107,14 @@ public interface UserApi { ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username); + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -82,6 +125,11 @@ public interface UserApi { ResponseEntity loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -90,6 +138,15 @@ public interface UserApi { ResponseEntity logoutUser(); + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApiController.java index 6c7ad6eaf7e..66c96808bef 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApiController.java @@ -32,26 +32,66 @@ public class UserApiController implements UserApi { this.request = request; } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUser + */ public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUsersWithArrayInput + */ public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUsersWithListInput + */ public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#deleteUser + */ public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#getUserByName + */ public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -69,16 +109,41 @@ public class UserApiController implements UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + * @see UserApi#loginUser + */ public ResponseEntity loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + * @see UserApi#logoutUser + */ public ResponseEntity logoutUser() { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#updateUser + */ public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApi.java index a7e416f15a6..309f8a53f4d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -27,6 +27,13 @@ import java.util.Map; @Api(value = "another-fake", description = "the another-fake API") public interface AnotherFakeApi { + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApiController.java index a01520a180f..4989f31bec7 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApiController.java @@ -31,6 +31,14 @@ public class AnotherFakeApiController implements AnotherFakeApi { this.request = request; } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + * @see AnotherFakeApi#call123testSpecialTags + */ public ResponseEntity call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java index 56d21638b37..3a28feb37c3 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java @@ -37,6 +37,13 @@ import java.util.Map; @Api(value = "fake", description = "the fake API") public interface FakeApi { + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -46,6 +53,13 @@ public interface FakeApi { ResponseEntity createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem); + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) @@ -55,6 +69,13 @@ public interface FakeApi { ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body); + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) @@ -64,6 +85,13 @@ public interface FakeApi { ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body); + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) @@ -73,6 +101,13 @@ public interface FakeApi { ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body); + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string", response = String.class) }) @@ -82,6 +117,13 @@ public interface FakeApi { ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body); + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -91,6 +133,13 @@ public interface FakeApi { ResponseEntity testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body); + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -100,6 +149,13 @@ public interface FakeApi { ResponseEntity testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body); + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -110,6 +166,27 @@ public interface FakeApi { ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake", }) @@ -119,9 +196,24 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback); + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -132,6 +224,18 @@ public interface FakeApi { ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestParam(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestParam(value="enum_form_string", required=false) String enumFormString); + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -140,6 +244,12 @@ public interface FakeApi { ResponseEntity testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group); + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -149,6 +259,13 @@ public interface FakeApi { ResponseEntity testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map param); + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -158,6 +275,17 @@ public interface FakeApi { ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true) @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true) @RequestParam(value="param2", required=true) String param2); + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -166,6 +294,14 @@ public interface FakeApi { ResponseEntity testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List context); + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -178,6 +314,6 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata); + ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApiController.java index af119a493c4..828761ab32e 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApiController.java @@ -41,16 +41,40 @@ public class FakeApiController implements FakeApi { this.request = request; } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + * @see FakeApi#createXmlItem + */ public ResponseEntity createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + * @see FakeApi#fakeOuterBooleanSerialize + */ public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + * @see FakeApi#fakeOuterCompositeSerialize + */ public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { @@ -63,26 +87,66 @@ public class FakeApiController implements FakeApi { } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + * @see FakeApi#fakeOuterNumberSerialize + */ public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + * @see FakeApi#fakeOuterStringSerialize + */ public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + * @see FakeApi#testBodyWithFileSchema + */ public ResponseEntity testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + * @see FakeApi#testBodyWithQueryParams + */ public ResponseEntity testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + * @see FakeApi#testClientModel + */ public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -95,37 +159,124 @@ public class FakeApiController implements FakeApi { } - public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see FakeApi#testEndpointParameters + */ + public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + * @see FakeApi#testEnumParameters + */ public ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestParam(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestParam(value="enum_form_string", required=false) String enumFormString) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + * @see FakeApi#testGroupParameters + */ public ResponseEntity testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + * @see FakeApi#testInlineAdditionalProperties + */ public ResponseEntity testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map param) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + * @see FakeApi#testJsonFormData + */ public ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true) @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true) @RequestParam(value="param2", required=true) String param2) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + * @see FakeApi#testQueryParameterCollectionFormat + */ public ResponseEntity testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List context) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } - public ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + * @see FakeApi#uploadFileWithRequiredFile + */ + public ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }"; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 4973979dc19..396f5e8be71 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -27,6 +27,13 @@ import java.util.Map; @Api(value = "fake_classname_test", description = "the fake_classname_test API") public interface FakeClassnameTestApi { + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java index 378b0d9a486..a5f610e3fb3 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java @@ -31,6 +31,14 @@ public class FakeClassnameTestApiController implements FakeClassnameTestApi { this.request = request; } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + * @see FakeClassnameTestApi#testClassname + */ public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApi.java index 8c386ce6d16..ac0da6bc88c 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApi.java @@ -29,6 +29,13 @@ import java.util.Map; @Api(value = "pet", description = "the pet API") public interface PetApi { + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -44,6 +51,14 @@ public interface PetApi { ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -58,6 +73,14 @@ public interface PetApi { ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -73,6 +96,15 @@ public interface PetApi { ResponseEntity> 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) List status); + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -88,6 +120,15 @@ public interface PetApi { ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -101,6 +142,15 @@ public interface PetApi { ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId); + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -118,6 +168,14 @@ public interface PetApi { ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -132,6 +190,14 @@ public interface PetApi { ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) String status); + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -144,6 +210,6 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file); + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java index b263f984ecd..efb678fc125 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java @@ -33,16 +33,42 @@ public class PetApiController implements PetApi { this.request = request; } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + * @see PetApi#addPet + */ public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + * @see PetApi#deletePet + */ public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 400) + * @see PetApi#findPetsByStatus + */ public ResponseEntity> 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) List status) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -60,6 +86,16 @@ public class PetApiController implements PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + * @see PetApi#findPetsByTags + */ public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -77,6 +113,16 @@ public class PetApiController implements PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * @see PetApi#getPetById + */ public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -94,17 +140,45 @@ public class PetApiController implements PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + * @see PetApi#updatePet + */ public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + * @see PetApi#updatePetWithForm + */ public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) String status) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } - public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + * @see PetApi#uploadFile + */ + public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }"; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApi.java index af2ec901102..b9366f2720c 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApi.java @@ -28,6 +28,14 @@ import java.util.Map; @Api(value = "store", description = "the store API") public interface StoreApi { + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -37,6 +45,12 @@ public interface StoreApi { ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId); + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -48,6 +62,15 @@ public interface StoreApi { ResponseEntity> getInventory(); + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -59,6 +82,13 @@ public interface StoreApi { ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId); + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApiController.java index 6d52b0acce5..cf845e3d944 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApiController.java @@ -32,16 +32,42 @@ public class StoreApiController implements StoreApi { this.request = request; } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + * @see StoreApi#deleteOrder + */ public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + * @see StoreApi#getInventory + */ public ResponseEntity> getInventory() { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + * @see StoreApi#getOrderById + */ public ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -59,6 +85,14 @@ public class StoreApiController implements StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + * @see StoreApi#placeOrder + */ public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApi.java index 53236596909..388e3cd0985 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApi.java @@ -28,6 +28,13 @@ import java.util.Map; @Api(value = "user", description = "the user API") public interface UserApi { + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -36,6 +43,12 @@ public interface UserApi { ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -44,6 +57,12 @@ public interface UserApi { ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -52,6 +71,14 @@ public interface UserApi { ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -61,6 +88,14 @@ public interface UserApi { ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username); + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -72,6 +107,14 @@ public interface UserApi { ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username); + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -82,6 +125,11 @@ public interface UserApi { ResponseEntity loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -90,6 +138,15 @@ public interface UserApi { ResponseEntity logoutUser(); + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApiController.java index d87450cf58e..f1b2455671e 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApiController.java @@ -32,26 +32,66 @@ public class UserApiController implements UserApi { this.request = request; } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUser + */ public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUsersWithArrayInput + */ public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUsersWithListInput + */ public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#deleteUser + */ public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#getUserByName + */ public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -69,16 +109,41 @@ public class UserApiController implements UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + * @see UserApi#loginUser + */ public ResponseEntity loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + * @see UserApi#logoutUser + */ public ResponseEntity logoutUser() { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#updateUser + */ public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApi.java index 6b98d70b930..24b88722ad4 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -31,6 +31,13 @@ public interface AnotherFakeApi { return new AnotherFakeApiDelegate() {}; } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java index a8c46f16e4a..1ccbe873d5a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java @@ -24,6 +24,11 @@ public interface AnotherFakeApiDelegate { } /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) * @see AnotherFakeApi#call123testSpecialTags */ default ResponseEntity call123testSpecialTags(Client body) { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java index 24a80478964..16097a6d904 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -41,6 +41,13 @@ public interface FakeApi { return new FakeApiDelegate() {}; } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -52,6 +59,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) @@ -63,6 +77,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) @@ -74,6 +95,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) @@ -85,6 +113,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string", response = String.class) }) @@ -96,6 +131,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -107,6 +149,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -118,6 +167,13 @@ public interface FakeApi { } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -130,6 +186,27 @@ public interface FakeApi { } + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake", }) @@ -139,11 +216,26 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return getDelegate().testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -156,6 +248,18 @@ public interface FakeApi { } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -166,6 +270,12 @@ public interface FakeApi { } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -177,6 +287,13 @@ public interface FakeApi { } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -188,6 +305,17 @@ public interface FakeApi { } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -198,6 +326,14 @@ public interface FakeApi { } + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -210,7 +346,7 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java index 9f4a2692e9e..c1dca5a4f28 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -34,6 +34,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) * @see FakeApi#createXmlItem */ default ResponseEntity createXmlItem(XmlItem xmlItem) { @@ -42,6 +47,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) * @see FakeApi#fakeOuterBooleanSerialize */ default ResponseEntity fakeOuterBooleanSerialize(Boolean body) { @@ -50,6 +60,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) * @see FakeApi#fakeOuterCompositeSerialize */ default ResponseEntity fakeOuterCompositeSerialize(OuterComposite body) { @@ -67,6 +82,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) * @see FakeApi#fakeOuterNumberSerialize */ default ResponseEntity fakeOuterNumberSerialize(BigDecimal body) { @@ -75,6 +95,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) * @see FakeApi#fakeOuterStringSerialize */ default ResponseEntity fakeOuterStringSerialize(String body) { @@ -83,6 +108,11 @@ public interface FakeApiDelegate { } /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) * @see FakeApi#testBodyWithFileSchema */ default ResponseEntity testBodyWithFileSchema(FileSchemaTestClass body) { @@ -91,6 +121,11 @@ public interface FakeApiDelegate { } /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) * @see FakeApi#testBodyWithQueryParams */ default ResponseEntity testBodyWithQueryParams(String query, @@ -100,6 +135,11 @@ public interface FakeApiDelegate { } /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) * @see FakeApi#testClientModel */ default ResponseEntity testClientModel(Client body) { @@ -117,6 +157,25 @@ public interface FakeApiDelegate { } /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) * @see FakeApi#testEndpointParameters */ default ResponseEntity testEndpointParameters(BigDecimal number, @@ -138,6 +197,19 @@ public interface FakeApiDelegate { } /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) * @see FakeApi#testEnumParameters */ default ResponseEntity testEnumParameters(List enumHeaderStringArray, @@ -153,6 +225,16 @@ public interface FakeApiDelegate { } /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) * @see FakeApi#testGroupParameters */ default ResponseEntity testGroupParameters(Integer requiredStringGroup, @@ -166,6 +248,10 @@ public interface FakeApiDelegate { } /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) * @see FakeApi#testInlineAdditionalProperties */ default ResponseEntity testInlineAdditionalProperties(Map param) { @@ -174,6 +260,11 @@ public interface FakeApiDelegate { } /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) * @see FakeApi#testJsonFormData */ default ResponseEntity testJsonFormData(String param, @@ -183,6 +274,15 @@ public interface FakeApiDelegate { } /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) * @see FakeApi#testQueryParameterCollectionFormat */ default ResponseEntity testQueryParameterCollectionFormat(List pipe, @@ -195,6 +295,12 @@ public interface FakeApiDelegate { } /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) * @see FakeApi#uploadFileWithRequiredFile */ default ResponseEntity uploadFileWithRequiredFile(Long petId, diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 51bf2839e5e..adbda34cc2d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -31,6 +31,13 @@ public interface FakeClassnameTestApi { return new FakeClassnameTestApiDelegate() {}; } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java index df29ad43a89..7436e049bde 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java @@ -24,6 +24,11 @@ public interface FakeClassnameTestApiDelegate { } /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) * @see FakeClassnameTestApi#testClassname */ default ResponseEntity testClassname(Client body) { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApi.java index 9748031902c..5a7e3460a0d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApi.java @@ -33,6 +33,13 @@ public interface PetApi { return new PetApiDelegate() {}; } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -50,6 +57,14 @@ public interface PetApi { } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -66,6 +81,14 @@ public interface PetApi { } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -83,6 +106,15 @@ public interface PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -100,6 +132,15 @@ public interface PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -115,6 +156,15 @@ public interface PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -134,6 +184,14 @@ public interface PetApi { } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -150,6 +208,14 @@ public interface PetApi { } + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -162,7 +228,7 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { return getDelegate().uploadFile(petId, additionalMetadata, file); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java index ea1a5ebed50..44d7d779d04 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -26,6 +26,11 @@ public interface PetApiDelegate { } /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) * @see PetApi#addPet */ default ResponseEntity addPet(Pet body) { @@ -34,6 +39,12 @@ public interface PetApiDelegate { } /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) * @see PetApi#deletePet */ default ResponseEntity deletePet(Long petId, @@ -43,6 +54,12 @@ public interface PetApiDelegate { } /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 400) * @see PetApi#findPetsByStatus */ default ResponseEntity> findPetsByStatus(List status) { @@ -65,6 +82,13 @@ public interface PetApiDelegate { } /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated * @see PetApi#findPetsByTags */ default ResponseEntity> findPetsByTags(List tags) { @@ -87,6 +111,13 @@ public interface PetApiDelegate { } /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) * @see PetApi#getPetById */ default ResponseEntity getPetById(Long petId) { @@ -109,6 +140,13 @@ public interface PetApiDelegate { } /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) * @see PetApi#updatePet */ default ResponseEntity updatePet(Pet body) { @@ -117,6 +155,12 @@ public interface PetApiDelegate { } /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) * @see PetApi#updatePetWithForm */ default ResponseEntity updatePetWithForm(Long petId, @@ -127,6 +171,12 @@ public interface PetApiDelegate { } /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) * @see PetApi#uploadFile */ default ResponseEntity uploadFile(Long petId, diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApi.java index 689f4a33256..a7c0b049264 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApi.java @@ -32,6 +32,14 @@ public interface StoreApi { return new StoreApiDelegate() {}; } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -43,6 +51,12 @@ public interface StoreApi { } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -56,6 +70,15 @@ public interface StoreApi { } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -69,6 +92,13 @@ public interface StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApiDelegate.java index 036309ceb6f..5fe814ddf2b 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApiDelegate.java @@ -25,6 +25,12 @@ public interface StoreApiDelegate { } /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) * @see StoreApi#deleteOrder */ default ResponseEntity deleteOrder(String orderId) { @@ -33,6 +39,10 @@ public interface StoreApiDelegate { } /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) * @see StoreApi#getInventory */ default ResponseEntity> getInventory() { @@ -41,6 +51,13 @@ public interface StoreApiDelegate { } /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) * @see StoreApi#getOrderById */ default ResponseEntity getOrderById(Long orderId) { @@ -63,6 +80,11 @@ public interface StoreApiDelegate { } /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) * @see StoreApi#placeOrder */ default ResponseEntity placeOrder(Order body) { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApi.java index da8a224572a..482a95e306d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApi.java @@ -32,6 +32,13 @@ public interface UserApi { return new UserApiDelegate() {}; } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -42,6 +49,12 @@ public interface UserApi { } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -52,6 +65,12 @@ public interface UserApi { } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -62,6 +81,14 @@ public interface UserApi { } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -73,6 +100,14 @@ public interface UserApi { } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -86,6 +121,14 @@ public interface UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -98,6 +141,11 @@ public interface UserApi { } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -108,6 +156,15 @@ public interface UserApi { } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java index c90d5e72219..9319e143d79 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -25,6 +25,11 @@ public interface UserApiDelegate { } /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) * @see UserApi#createUser */ default ResponseEntity createUser(User body) { @@ -33,6 +38,10 @@ public interface UserApiDelegate { } /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) * @see UserApi#createUsersWithArrayInput */ default ResponseEntity createUsersWithArrayInput(List body) { @@ -41,6 +50,10 @@ public interface UserApiDelegate { } /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) * @see UserApi#createUsersWithListInput */ default ResponseEntity createUsersWithListInput(List body) { @@ -49,6 +62,12 @@ public interface UserApiDelegate { } /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) * @see UserApi#deleteUser */ default ResponseEntity deleteUser(String username) { @@ -57,6 +76,12 @@ public interface UserApiDelegate { } /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) * @see UserApi#getUserByName */ default ResponseEntity getUserByName(String username) { @@ -79,6 +104,12 @@ public interface UserApiDelegate { } /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) * @see UserApi#loginUser */ default ResponseEntity loginUser(String username, @@ -88,6 +119,9 @@ public interface UserApiDelegate { } /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) * @see UserApi#logoutUser */ default ResponseEntity logoutUser() { @@ -96,6 +130,13 @@ public interface UserApiDelegate { } /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) * @see UserApi#updateUser */ default ResponseEntity updateUser(String username, diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApi.java index a7e416f15a6..309f8a53f4d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -27,6 +27,13 @@ import java.util.Map; @Api(value = "another-fake", description = "the another-fake API") public interface AnotherFakeApi { + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApiController.java index b4a93799157..a399943f89c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApiController.java @@ -29,6 +29,14 @@ public class AnotherFakeApiController implements AnotherFakeApi { this.delegate = delegate; } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + * @see AnotherFakeApi#call123testSpecialTags + */ public ResponseEntity call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { return delegate.call123testSpecialTags(body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java index 1ee11ed7327..a81e1aa6f58 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java @@ -16,6 +16,11 @@ import java.util.Map; public interface AnotherFakeApiDelegate { /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) * @see AnotherFakeApi#call123testSpecialTags */ ResponseEntity call123testSpecialTags(Client body); diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java index 56d21638b37..3a28feb37c3 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java @@ -37,6 +37,13 @@ import java.util.Map; @Api(value = "fake", description = "the fake API") public interface FakeApi { + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -46,6 +53,13 @@ public interface FakeApi { ResponseEntity createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem); + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) @@ -55,6 +69,13 @@ public interface FakeApi { ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body); + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) @@ -64,6 +85,13 @@ public interface FakeApi { ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body); + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) @@ -73,6 +101,13 @@ public interface FakeApi { ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body); + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string", response = String.class) }) @@ -82,6 +117,13 @@ public interface FakeApi { ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body); + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -91,6 +133,13 @@ public interface FakeApi { ResponseEntity testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body); + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -100,6 +149,13 @@ public interface FakeApi { ResponseEntity testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body); + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -110,6 +166,27 @@ public interface FakeApi { ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake", }) @@ -119,9 +196,24 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback); + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -132,6 +224,18 @@ public interface FakeApi { ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestParam(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestParam(value="enum_form_string", required=false) String enumFormString); + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -140,6 +244,12 @@ public interface FakeApi { ResponseEntity testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group); + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -149,6 +259,13 @@ public interface FakeApi { ResponseEntity testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map param); + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -158,6 +275,17 @@ public interface FakeApi { ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true) @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true) @RequestParam(value="param2", required=true) String param2); + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -166,6 +294,14 @@ public interface FakeApi { ResponseEntity testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List context); + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -178,6 +314,6 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata); + ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiController.java index dcfb5423b51..705a9150f76 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiController.java @@ -39,63 +39,214 @@ public class FakeApiController implements FakeApi { this.delegate = delegate; } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + * @see FakeApi#createXmlItem + */ public ResponseEntity createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem) { return delegate.createXmlItem(xmlItem); } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + * @see FakeApi#fakeOuterBooleanSerialize + */ public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { return delegate.fakeOuterBooleanSerialize(body); } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + * @see FakeApi#fakeOuterCompositeSerialize + */ public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { return delegate.fakeOuterCompositeSerialize(body); } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + * @see FakeApi#fakeOuterNumberSerialize + */ public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { return delegate.fakeOuterNumberSerialize(body); } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + * @see FakeApi#fakeOuterStringSerialize + */ public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { return delegate.fakeOuterStringSerialize(body); } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + * @see FakeApi#testBodyWithFileSchema + */ public ResponseEntity testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body) { return delegate.testBodyWithFileSchema(body); } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + * @see FakeApi#testBodyWithQueryParams + */ public ResponseEntity testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body) { return delegate.testBodyWithQueryParams(query, body); } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + * @see FakeApi#testClientModel + */ public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { return delegate.testClientModel(body); } - public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see FakeApi#testEndpointParameters + */ + public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + * @see FakeApi#testEnumParameters + */ public ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestParam(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestParam(value="enum_form_string", required=false) String enumFormString) { return delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + * @see FakeApi#testGroupParameters + */ public ResponseEntity testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group) { return delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + * @see FakeApi#testInlineAdditionalProperties + */ public ResponseEntity testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map param) { return delegate.testInlineAdditionalProperties(param); } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + * @see FakeApi#testJsonFormData + */ public ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true) @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true) @RequestParam(value="param2", required=true) String param2) { return delegate.testJsonFormData(param, param2); } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + * @see FakeApi#testQueryParameterCollectionFormat + */ public ResponseEntity testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List context) { return delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); } - public ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + * @see FakeApi#uploadFileWithRequiredFile + */ + public ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { return delegate.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java index fea1038544c..f1793eb192e 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -26,47 +26,106 @@ import java.util.Map; public interface FakeApiDelegate { /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) * @see FakeApi#createXmlItem */ ResponseEntity createXmlItem(XmlItem xmlItem); /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) * @see FakeApi#fakeOuterBooleanSerialize */ ResponseEntity fakeOuterBooleanSerialize(Boolean body); /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) * @see FakeApi#fakeOuterCompositeSerialize */ ResponseEntity fakeOuterCompositeSerialize(OuterComposite body); /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) * @see FakeApi#fakeOuterNumberSerialize */ ResponseEntity fakeOuterNumberSerialize(BigDecimal body); /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) * @see FakeApi#fakeOuterStringSerialize */ ResponseEntity fakeOuterStringSerialize(String body); /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) * @see FakeApi#testBodyWithFileSchema */ ResponseEntity testBodyWithFileSchema(FileSchemaTestClass body); /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) * @see FakeApi#testBodyWithQueryParams */ ResponseEntity testBodyWithQueryParams(String query, User body); /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) * @see FakeApi#testClientModel */ ResponseEntity testClientModel(Client body); /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) * @see FakeApi#testEndpointParameters */ ResponseEntity testEndpointParameters(BigDecimal number, @@ -85,6 +144,19 @@ public interface FakeApiDelegate { String paramCallback); /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) * @see FakeApi#testEnumParameters */ ResponseEntity testEnumParameters(List enumHeaderStringArray, @@ -97,6 +169,16 @@ public interface FakeApiDelegate { String enumFormString); /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) * @see FakeApi#testGroupParameters */ ResponseEntity testGroupParameters(Integer requiredStringGroup, @@ -107,17 +189,35 @@ public interface FakeApiDelegate { Long int64Group); /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) * @see FakeApi#testInlineAdditionalProperties */ ResponseEntity testInlineAdditionalProperties(Map param); /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) * @see FakeApi#testJsonFormData */ ResponseEntity testJsonFormData(String param, String param2); /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) * @see FakeApi#testQueryParameterCollectionFormat */ ResponseEntity testQueryParameterCollectionFormat(List pipe, @@ -127,6 +227,12 @@ public interface FakeApiDelegate { List context); /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) * @see FakeApi#uploadFileWithRequiredFile */ ResponseEntity uploadFileWithRequiredFile(Long petId, diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 4973979dc19..396f5e8be71 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -27,6 +27,13 @@ import java.util.Map; @Api(value = "fake_classname_test", description = "the fake_classname_test API") public interface FakeClassnameTestApi { + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java index 330dbe26560..f3e152d2883 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java @@ -29,6 +29,14 @@ public class FakeClassnameTestApiController implements FakeClassnameTestApi { this.delegate = delegate; } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + * @see FakeClassnameTestApi#testClassname + */ public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { return delegate.testClassname(body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java index d9a6b31331e..fbf48bc9fcf 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java @@ -16,6 +16,11 @@ import java.util.Map; public interface FakeClassnameTestApiDelegate { /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) * @see FakeClassnameTestApi#testClassname */ ResponseEntity testClassname(Client body); diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApi.java index 8c386ce6d16..ac0da6bc88c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApi.java @@ -29,6 +29,13 @@ import java.util.Map; @Api(value = "pet", description = "the pet API") public interface PetApi { + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -44,6 +51,14 @@ public interface PetApi { ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -58,6 +73,14 @@ public interface PetApi { ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -73,6 +96,15 @@ public interface PetApi { ResponseEntity> 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) List status); + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -88,6 +120,15 @@ public interface PetApi { ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -101,6 +142,15 @@ public interface PetApi { ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId); + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -118,6 +168,14 @@ public interface PetApi { ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -132,6 +190,14 @@ public interface PetApi { ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) String status); + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -144,6 +210,6 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file); + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApiController.java index 044a3f70054..02670b32e6a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApiController.java @@ -31,35 +31,109 @@ public class PetApiController implements PetApi { this.delegate = delegate; } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + * @see PetApi#addPet + */ public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { return delegate.addPet(body); } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + * @see PetApi#deletePet + */ public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { return delegate.deletePet(petId, apiKey); } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 400) + * @see PetApi#findPetsByStatus + */ public ResponseEntity> 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) List status) { return delegate.findPetsByStatus(status); } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + * @see PetApi#findPetsByTags + */ public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { return delegate.findPetsByTags(tags); } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * @see PetApi#getPetById + */ public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) { return delegate.getPetById(petId); } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + * @see PetApi#updatePet + */ public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { return delegate.updatePet(body); } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + * @see PetApi#updatePetWithForm + */ public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) String status) { return delegate.updatePetWithForm(petId, name, status); } - public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + * @see PetApi#uploadFile + */ + public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { return delegate.uploadFile(petId, additionalMetadata, file); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApiDelegate.java index 74053a91cd7..da180785c56 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -18,37 +18,81 @@ import java.util.Map; public interface PetApiDelegate { /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) * @see PetApi#addPet */ ResponseEntity addPet(Pet body); /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) * @see PetApi#deletePet */ ResponseEntity deletePet(Long petId, String apiKey); /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 400) * @see PetApi#findPetsByStatus */ ResponseEntity> findPetsByStatus(List status); /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated * @see PetApi#findPetsByTags */ ResponseEntity> findPetsByTags(List tags); /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) * @see PetApi#getPetById */ ResponseEntity getPetById(Long petId); /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) * @see PetApi#updatePet */ ResponseEntity updatePet(Pet body); /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) * @see PetApi#updatePetWithForm */ ResponseEntity updatePetWithForm(Long petId, @@ -56,6 +100,12 @@ public interface PetApiDelegate { String status); /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) * @see PetApi#uploadFile */ ResponseEntity uploadFile(Long petId, diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java index af2ec901102..b9366f2720c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java @@ -28,6 +28,14 @@ import java.util.Map; @Api(value = "store", description = "the store API") public interface StoreApi { + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -37,6 +45,12 @@ public interface StoreApi { ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId); + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -48,6 +62,15 @@ public interface StoreApi { ResponseEntity> getInventory(); + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -59,6 +82,13 @@ public interface StoreApi { ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId); + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApiController.java index cf2bc8afc84..61a4fc93b52 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApiController.java @@ -30,18 +30,52 @@ public class StoreApiController implements StoreApi { this.delegate = delegate; } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + * @see StoreApi#deleteOrder + */ public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId) { return delegate.deleteOrder(orderId); } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + * @see StoreApi#getInventory + */ public ResponseEntity> getInventory() { return delegate.getInventory(); } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + * @see StoreApi#getOrderById + */ public ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) { return delegate.getOrderById(orderId); } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + * @see StoreApi#placeOrder + */ public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { return delegate.placeOrder(body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApiDelegate.java index da02eed54b5..a3c84b99216 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApiDelegate.java @@ -17,21 +17,43 @@ import java.util.Map; public interface StoreApiDelegate { /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) * @see StoreApi#deleteOrder */ ResponseEntity deleteOrder(String orderId); /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) * @see StoreApi#getInventory */ ResponseEntity> getInventory(); /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) * @see StoreApi#getOrderById */ ResponseEntity getOrderById(Long orderId); /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) * @see StoreApi#placeOrder */ ResponseEntity placeOrder(Order body); diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApi.java index 53236596909..388e3cd0985 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApi.java @@ -28,6 +28,13 @@ import java.util.Map; @Api(value = "user", description = "the user API") public interface UserApi { + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -36,6 +43,12 @@ public interface UserApi { ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -44,6 +57,12 @@ public interface UserApi { ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -52,6 +71,14 @@ public interface UserApi { ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -61,6 +88,14 @@ public interface UserApi { ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username); + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -72,6 +107,14 @@ public interface UserApi { ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username); + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -82,6 +125,11 @@ public interface UserApi { ResponseEntity loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -90,6 +138,15 @@ public interface UserApi { ResponseEntity logoutUser(); + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiController.java index e79e68193c9..ae2097f06e1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiController.java @@ -30,34 +30,99 @@ public class UserApiController implements UserApi { this.delegate = delegate; } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUser + */ public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { return delegate.createUser(body); } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUsersWithArrayInput + */ public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { return delegate.createUsersWithArrayInput(body); } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUsersWithListInput + */ public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { return delegate.createUsersWithListInput(body); } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#deleteUser + */ public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) { return delegate.deleteUser(username); } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#getUserByName + */ public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) { return delegate.getUserByName(username); } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + * @see UserApi#loginUser + */ public ResponseEntity loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) { return delegate.loginUser(username, password); } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + * @see UserApi#logoutUser + */ public ResponseEntity logoutUser() { return delegate.logoutUser(); } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#updateUser + */ public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { return delegate.updateUser(username, body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiDelegate.java index dc90b13aed3..021cbf1ad7b 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -17,42 +17,83 @@ import java.util.Map; public interface UserApiDelegate { /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) * @see UserApi#createUser */ ResponseEntity createUser(User body); /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) * @see UserApi#createUsersWithArrayInput */ ResponseEntity createUsersWithArrayInput(List body); /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) * @see UserApi#createUsersWithListInput */ ResponseEntity createUsersWithListInput(List body); /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) * @see UserApi#deleteUser */ ResponseEntity deleteUser(String username); /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) * @see UserApi#getUserByName */ ResponseEntity getUserByName(String username); /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) * @see UserApi#loginUser */ ResponseEntity loginUser(String username, String password); /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) * @see UserApi#logoutUser */ ResponseEntity logoutUser(); /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) * @see UserApi#updateUser */ ResponseEntity updateUser(String username, diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/AnotherFakeApi.java index f7fd8d7c44e..7c49e7f9982 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -35,6 +35,13 @@ public interface AnotherFakeApi { return Optional.empty(); } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index 586ff8a4b32..6d1b2ed72a2 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -45,6 +45,13 @@ public interface FakeApi { return Optional.empty(); } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -59,6 +66,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) @@ -73,6 +87,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) @@ -96,6 +117,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) @@ -110,6 +138,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string", response = String.class) }) @@ -124,6 +159,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -138,6 +180,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -152,6 +201,13 @@ public interface FakeApi { } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -176,6 +232,27 @@ public interface FakeApi { } + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake", }) @@ -187,12 +264,25 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -210,6 +300,16 @@ public interface FakeApi { } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -225,6 +325,12 @@ public interface FakeApi { } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -239,6 +345,13 @@ public interface FakeApi { } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -253,6 +366,17 @@ public interface FakeApi { } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -266,6 +390,14 @@ public interface FakeApi { } + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -280,7 +412,7 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index c16af61510b..5170f0e4911 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -35,6 +35,13 @@ public interface FakeClassnameTestApi { return Optional.empty(); } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java index f979db0ab9b..0e43ad6372d 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java @@ -37,6 +37,13 @@ public interface PetApi { return Optional.empty(); } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -57,6 +64,13 @@ public interface PetApi { } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -77,6 +91,14 @@ public interface PetApi { } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -111,6 +133,15 @@ public interface PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -145,6 +176,15 @@ public interface PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -177,6 +217,15 @@ public interface PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -199,6 +248,14 @@ public interface PetApi { } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -218,6 +275,14 @@ public interface PetApi { } + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -232,7 +297,7 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java index c1a4c1365d9..9974664bcc6 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java @@ -36,6 +36,14 @@ public interface StoreApi { return Optional.empty(); } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -50,6 +58,12 @@ public interface StoreApi { } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -66,6 +80,15 @@ public interface StoreApi { } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -96,6 +119,13 @@ public interface StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java index c2f0fa81d6f..5d3419066e1 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java @@ -36,6 +36,13 @@ public interface UserApi { return Optional.empty(); } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -49,6 +56,12 @@ public interface UserApi { } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -62,6 +75,12 @@ public interface UserApi { } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -75,6 +94,14 @@ public interface UserApi { } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -89,6 +116,14 @@ public interface UserApi { } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -119,6 +154,14 @@ public interface UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -134,6 +177,11 @@ public interface UserApi { } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -147,6 +195,15 @@ public interface UserApi { } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApi.java index dfc5042c0ab..1d199c40e5a 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -34,6 +34,13 @@ public interface AnotherFakeApi { return new AnotherFakeApiDelegate() {}; } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java index 549a66207fa..b3b75e8872b 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java @@ -27,6 +27,11 @@ public interface AnotherFakeApiDelegate { } /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) * @see AnotherFakeApi#call123testSpecialTags */ default Mono> call123testSpecialTags(Mono body, diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java index 9a66176f085..0fef5562fac 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -44,6 +44,13 @@ public interface FakeApi { return new FakeApiDelegate() {}; } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -55,6 +62,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) @@ -66,6 +80,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) @@ -77,6 +98,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) @@ -88,6 +116,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string", response = String.class) }) @@ -99,6 +134,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -110,6 +152,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -121,6 +170,13 @@ public interface FakeApi { } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -133,6 +189,27 @@ public interface FakeApi { } + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake", }) @@ -142,11 +219,26 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default Mono> testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback, ServerWebExchange exchange) { + default Mono> testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback, ServerWebExchange exchange) { return getDelegate().testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, exchange); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -159,6 +251,18 @@ public interface FakeApi { } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -169,6 +273,12 @@ public interface FakeApi { } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -180,6 +290,13 @@ public interface FakeApi { } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -191,6 +308,17 @@ public interface FakeApi { } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -201,6 +329,14 @@ public interface FakeApi { } + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -213,7 +349,7 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default Mono> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata, ServerWebExchange exchange) { + default Mono> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata, ServerWebExchange exchange) { return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, exchange); } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java index c61a3d26c7c..8c148c15140 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -37,6 +37,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) * @see FakeApi#createXmlItem */ default Mono> createXmlItem(Mono xmlItem, @@ -48,6 +53,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) * @see FakeApi#fakeOuterBooleanSerialize */ default Mono> fakeOuterBooleanSerialize(Mono body, @@ -59,6 +69,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) * @see FakeApi#fakeOuterCompositeSerialize */ default Mono> fakeOuterCompositeSerialize(Mono body, @@ -77,6 +92,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) * @see FakeApi#fakeOuterNumberSerialize */ default Mono> fakeOuterNumberSerialize(Mono body, @@ -88,6 +108,11 @@ public interface FakeApiDelegate { } /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) * @see FakeApi#fakeOuterStringSerialize */ default Mono> fakeOuterStringSerialize(Mono body, @@ -99,6 +124,11 @@ public interface FakeApiDelegate { } /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) * @see FakeApi#testBodyWithFileSchema */ default Mono> testBodyWithFileSchema(Mono body, @@ -110,6 +140,11 @@ public interface FakeApiDelegate { } /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) * @see FakeApi#testBodyWithQueryParams */ default Mono> testBodyWithQueryParams(String query, @@ -122,6 +157,11 @@ public interface FakeApiDelegate { } /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) * @see FakeApi#testClientModel */ default Mono> testClientModel(Mono body, @@ -140,6 +180,25 @@ public interface FakeApiDelegate { } /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) * @see FakeApi#testEndpointParameters */ default Mono> testEndpointParameters(BigDecimal number, @@ -164,6 +223,19 @@ public interface FakeApiDelegate { } /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) * @see FakeApi#testEnumParameters */ default Mono> testEnumParameters(List enumHeaderStringArray, @@ -182,6 +254,16 @@ public interface FakeApiDelegate { } /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) * @see FakeApi#testGroupParameters */ default Mono> testGroupParameters(Integer requiredStringGroup, @@ -198,6 +280,10 @@ public interface FakeApiDelegate { } /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) * @see FakeApi#testInlineAdditionalProperties */ default Mono> testInlineAdditionalProperties(Mono param, @@ -209,6 +295,11 @@ public interface FakeApiDelegate { } /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) * @see FakeApi#testJsonFormData */ default Mono> testJsonFormData(String param, @@ -221,6 +312,15 @@ public interface FakeApiDelegate { } /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) * @see FakeApi#testQueryParameterCollectionFormat */ default Mono> testQueryParameterCollectionFormat(List pipe, @@ -236,6 +336,12 @@ public interface FakeApiDelegate { } /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) * @see FakeApi#uploadFileWithRequiredFile */ default Mono> uploadFileWithRequiredFile(Long petId, diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 25b16bafabd..a9618de3356 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -34,6 +34,13 @@ public interface FakeClassnameTestApi { return new FakeClassnameTestApiDelegate() {}; } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java index 0373ca1aec3..f273c4040bc 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java @@ -27,6 +27,11 @@ public interface FakeClassnameTestApiDelegate { } /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) * @see FakeClassnameTestApi#testClassname */ default Mono> testClassname(Mono body, diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java index 65d46836963..d57d946edc2 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java @@ -36,6 +36,13 @@ public interface PetApi { return new PetApiDelegate() {}; } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -53,6 +60,14 @@ public interface PetApi { } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -69,6 +84,14 @@ public interface PetApi { } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -86,6 +109,15 @@ public interface PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -103,6 +135,15 @@ public interface PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -118,6 +159,15 @@ public interface PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -137,6 +187,14 @@ public interface PetApi { } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -153,6 +211,14 @@ public interface PetApi { } + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -165,7 +231,7 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default Mono> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file, ServerWebExchange exchange) { + default Mono> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file, ServerWebExchange exchange) { return getDelegate().uploadFile(petId, additionalMetadata, file, exchange); } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java index f8f3d8fd98c..69511f24674 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -29,6 +29,11 @@ public interface PetApiDelegate { } /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) * @see PetApi#addPet */ default Mono> addPet(Mono body, @@ -40,6 +45,12 @@ public interface PetApiDelegate { } /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) * @see PetApi#deletePet */ default Mono> deletePet(Long petId, @@ -52,6 +63,12 @@ public interface PetApiDelegate { } /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 400) * @see PetApi#findPetsByStatus */ default Mono>> findPetsByStatus(List status, @@ -75,6 +92,13 @@ public interface PetApiDelegate { } /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated * @see PetApi#findPetsByTags */ default Mono>> findPetsByTags(List tags, @@ -98,6 +122,13 @@ public interface PetApiDelegate { } /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) * @see PetApi#getPetById */ default Mono> getPetById(Long petId, @@ -121,6 +152,13 @@ public interface PetApiDelegate { } /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) * @see PetApi#updatePet */ default Mono> updatePet(Mono body, @@ -132,6 +170,12 @@ public interface PetApiDelegate { } /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) * @see PetApi#updatePetWithForm */ default Mono> updatePetWithForm(Long petId, @@ -145,6 +189,12 @@ public interface PetApiDelegate { } /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) * @see PetApi#uploadFile */ default Mono> uploadFile(Long petId, diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApi.java index 8ae70a6c299..7c6f2947cb3 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApi.java @@ -35,6 +35,14 @@ public interface StoreApi { return new StoreApiDelegate() {}; } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -46,6 +54,12 @@ public interface StoreApi { } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -59,6 +73,15 @@ public interface StoreApi { } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -72,6 +95,13 @@ public interface StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiDelegate.java index 672d1dbb8d3..7aad4e8fc2e 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiDelegate.java @@ -28,6 +28,12 @@ public interface StoreApiDelegate { } /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) * @see StoreApi#deleteOrder */ default Mono> deleteOrder(String orderId, @@ -39,6 +45,10 @@ public interface StoreApiDelegate { } /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) * @see StoreApi#getInventory */ default Mono>> getInventory(ServerWebExchange exchange) { @@ -49,6 +59,13 @@ public interface StoreApiDelegate { } /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) * @see StoreApi#getOrderById */ default Mono> getOrderById(Long orderId, @@ -72,6 +89,11 @@ public interface StoreApiDelegate { } /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) * @see StoreApi#placeOrder */ default Mono> placeOrder(Mono body, 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 4a975b1efc2..8e00baae5e7 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 @@ -35,6 +35,13 @@ public interface UserApi { return new UserApiDelegate() {}; } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -45,6 +52,12 @@ public interface UserApi { } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -55,6 +68,12 @@ public interface UserApi { } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -65,6 +84,14 @@ public interface UserApi { } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -76,6 +103,14 @@ public interface UserApi { } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -89,6 +124,14 @@ public interface UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -101,6 +144,11 @@ public interface UserApi { } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -111,6 +159,15 @@ public interface UserApi { } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), 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 13994de33a8..6b8e3d5d818 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 @@ -28,6 +28,11 @@ public interface UserApiDelegate { } /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) * @see UserApi#createUser */ default Mono> createUser(Mono body, @@ -39,6 +44,10 @@ public interface UserApiDelegate { } /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) * @see UserApi#createUsersWithArrayInput */ default Mono> createUsersWithArrayInput(Flux body, @@ -50,6 +59,10 @@ public interface UserApiDelegate { } /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) * @see UserApi#createUsersWithListInput */ default Mono> createUsersWithListInput(Flux body, @@ -61,6 +74,12 @@ public interface UserApiDelegate { } /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) * @see UserApi#deleteUser */ default Mono> deleteUser(String username, @@ -72,6 +91,12 @@ public interface UserApiDelegate { } /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) * @see UserApi#getUserByName */ default Mono> getUserByName(String username, @@ -95,6 +120,12 @@ public interface UserApiDelegate { } /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) * @see UserApi#loginUser */ default Mono> loginUser(String username, @@ -107,6 +138,9 @@ public interface UserApiDelegate { } /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) * @see UserApi#logoutUser */ default Mono> logoutUser(ServerWebExchange exchange) { @@ -117,6 +151,13 @@ public interface UserApiDelegate { } /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) * @see UserApi#updateUser */ default Mono> updateUser(String username, diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/AnotherFakeApi.java index d38de995bd4..3a3e7419b11 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -35,6 +35,13 @@ public interface AnotherFakeApi { return Optional.empty(); } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java index 21064a749ab..e4b8305aaba 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java @@ -45,6 +45,13 @@ public interface FakeApi { return Optional.empty(); } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -57,6 +64,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) @@ -69,6 +83,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) @@ -90,6 +111,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) @@ -102,6 +130,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string", response = String.class) }) @@ -114,6 +149,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -126,6 +168,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -138,6 +187,13 @@ public interface FakeApi { } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -160,6 +216,27 @@ public interface FakeApi { } + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake", }) @@ -169,12 +246,27 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -188,6 +280,18 @@ public interface FakeApi { } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -199,6 +303,12 @@ public interface FakeApi { } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -211,6 +321,13 @@ public interface FakeApi { } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -223,6 +340,17 @@ public interface FakeApi { } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -234,6 +362,14 @@ public interface FakeApi { } + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -246,7 +382,7 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 4e909df0825..cc5266e4cf0 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -35,6 +35,13 @@ public interface FakeClassnameTestApi { return Optional.empty(); } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java index b0ef6b60083..d58ca42f714 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java @@ -37,6 +37,13 @@ public interface PetApi { return Optional.empty(); } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -55,6 +62,14 @@ public interface PetApi { } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -72,6 +87,14 @@ public interface PetApi { } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -104,6 +127,15 @@ public interface PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -136,6 +168,15 @@ public interface PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -166,6 +207,15 @@ public interface PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -186,6 +236,14 @@ public interface PetApi { } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -203,6 +261,14 @@ public interface PetApi { } + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -215,7 +281,7 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java index 1838f04257e..88f857d3eb7 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java @@ -36,6 +36,14 @@ public interface StoreApi { return Optional.empty(); } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -48,6 +56,12 @@ public interface StoreApi { } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -62,6 +76,15 @@ public interface StoreApi { } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -90,6 +113,13 @@ public interface StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java index bb6ed796e7b..96b0f11ac16 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java @@ -36,6 +36,13 @@ public interface UserApi { return Optional.empty(); } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -47,6 +54,12 @@ public interface UserApi { } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -58,6 +71,12 @@ public interface UserApi { } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -69,6 +88,14 @@ public interface UserApi { } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -81,6 +108,14 @@ public interface UserApi { } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -109,6 +144,14 @@ public interface UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -122,6 +165,11 @@ public interface UserApi { } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -133,6 +181,15 @@ public interface UserApi { } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApi.java index 9a41d71dc34..4652c1ac295 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApi.java @@ -38,6 +38,13 @@ public interface AnotherFakeApi { return Optional.empty(); } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java index 79efa798414..de526db1527 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java @@ -48,6 +48,13 @@ public interface FakeApi { return Optional.empty(); } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @@ -61,6 +68,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiVirtual @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @@ -74,6 +88,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiVirtual @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @@ -96,6 +117,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiVirtual @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @@ -109,6 +137,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiVirtual @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @@ -122,6 +157,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiVirtual @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @@ -135,6 +177,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiVirtual @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @@ -148,6 +197,13 @@ public interface FakeApi { } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @@ -171,6 +227,27 @@ public interface FakeApi { } + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiVirtual @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") @@ -181,12 +258,27 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiVirtual @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @@ -201,6 +293,18 @@ public interface FakeApi { } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiVirtual @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @@ -213,6 +317,12 @@ public interface FakeApi { } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @@ -226,6 +336,13 @@ public interface FakeApi { } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @@ -239,6 +356,17 @@ public interface FakeApi { } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiVirtual @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @@ -251,6 +379,14 @@ public interface FakeApi { } + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -264,7 +400,7 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java index 64f666b7aa6..78cd4755165 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java @@ -38,6 +38,13 @@ public interface FakeClassnameTestApi { return Optional.empty(); } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApi.java index b0b7aacec4a..42ec53c1a40 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApi.java @@ -40,6 +40,13 @@ public interface PetApi { return Optional.empty(); } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @ApiVirtual @ApiOperation(value = "Add a new pet to the store", nickname = "addPet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -59,6 +66,14 @@ public interface PetApi { } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiVirtual @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -77,6 +92,14 @@ public interface PetApi { } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 400) + */ @ApiVirtual @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 = { @@ -110,6 +133,15 @@ public interface PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @ApiVirtual @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 = { @@ -143,6 +175,15 @@ public interface PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiVirtual @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") @@ -174,6 +215,15 @@ public interface PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @ApiVirtual @ApiOperation(value = "Update an existing pet", nickname = "updatePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -195,6 +245,14 @@ public interface PetApi { } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @ApiVirtual @ApiOperation(value = "Updates a pet in the store with form data", nickname = "updatePetWithForm", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -213,6 +271,14 @@ public interface PetApi { } + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "uploads an image", nickname = "uploadFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -226,7 +292,7 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java index 275055a2ebd..e8c9467589d 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java @@ -39,6 +39,14 @@ public interface StoreApi { return Optional.empty(); } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @ApiVirtual @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", tags={ "store", }) @ApiResponses(value = { @@ -52,6 +60,12 @@ public interface StoreApi { } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") @@ -67,6 +81,15 @@ public interface StoreApi { } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @ApiVirtual @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, tags={ "store", }) @ApiResponses(value = { @@ -96,6 +119,13 @@ public interface StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiVirtual @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java index 0bbb846143c..b73c9b83308 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java @@ -39,6 +39,13 @@ public interface UserApi { return Optional.empty(); } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @@ -51,6 +58,12 @@ public interface UserApi { } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @@ -63,6 +76,12 @@ public interface UserApi { } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @@ -75,6 +94,14 @@ public interface UserApi { } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiVirtual @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @@ -88,6 +115,14 @@ public interface UserApi { } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiVirtual @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @@ -117,6 +152,14 @@ public interface UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiVirtual @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @@ -131,6 +174,11 @@ public interface UserApi { } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiVirtual @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @@ -143,6 +191,15 @@ public interface UserApi { } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiVirtual @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/AnotherFakeApi.java index d38de995bd4..3a3e7419b11 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -35,6 +35,13 @@ public interface AnotherFakeApi { return Optional.empty(); } + /** + * PATCH /another-fake/dummy : To test special tags + * To test special tags and operation ID starting with number + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java index b8e6bb3fabb..c5ec4936c3f 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java @@ -45,6 +45,13 @@ public interface FakeApi { return Optional.empty(); } + /** + * POST /fake/create_xml_item : creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "creates an XmlItem", nickname = "createXmlItem", notes = "this route creates an XmlItem", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -57,6 +64,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/boolean + * Test serialization of outer boolean types + * + * @param body Input boolean as post body (optional) + * @return Output boolean (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) @@ -69,6 +83,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/composite + * Test serialization of object with outer number type + * + * @param body Input composite as post body (optional) + * @return Output composite (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) @@ -90,6 +111,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/number + * Test serialization of outer number types + * + * @param body Input number as post body (optional) + * @return Output number (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) @@ -102,6 +130,13 @@ public interface FakeApi { } + /** + * POST /fake/outer/string + * Test serialization of outer string types + * + * @param body Input string as post body (optional) + * @return Output string (status code 200) + */ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string", response = String.class) }) @@ -114,6 +149,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-file-schema + * For this test, the body for this request much reference a schema named `File`. + * + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithFileSchema", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -126,6 +168,13 @@ public interface FakeApi { } + /** + * PUT /fake/body-with-query-params + * + * @param query (required) + * @param body (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -138,6 +187,13 @@ public interface FakeApi { } + /** + * PATCH /fake : To test \"client\" model + * To test \"client\" model + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -160,6 +216,27 @@ public interface FakeApi { } + /** + * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake", }) @@ -169,12 +246,27 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @Valid @RequestPart("binary") MultipartFile binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + /** + * GET /fake : To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Invalid request (status code 400) + * or Not found (status code 404) + */ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @@ -188,6 +280,18 @@ public interface FakeApi { } + /** + * DELETE /fake : Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return Someting wrong (status code 400) + */ @ApiOperation(value = "Fake endpoint to test group parameters (optional)", nickname = "testGroupParameters", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Someting wrong") }) @@ -199,6 +303,12 @@ public interface FakeApi { } + /** + * POST /fake/inline-additionalProperties : test inline additionalProperties + * + * @param param request body (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -211,6 +321,13 @@ public interface FakeApi { } + /** + * GET /fake/jsonFormData : test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -223,6 +340,17 @@ public interface FakeApi { } + /** + * PUT /fake/test-query-paramters + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return Success (status code 200) + */ @ApiOperation(value = "", nickname = "testQueryParameterCollectionFormat", notes = "To test the collection format in query parameters", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) @@ -234,6 +362,14 @@ public interface FakeApi { } + /** + * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return successful operation (status code 200) + */ @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -246,7 +382,7 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + default ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart("requiredFile") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 4e909df0825..cc5266e4cf0 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -35,6 +35,13 @@ public interface FakeClassnameTestApi { return Optional.empty(); } + /** + * PATCH /fake_classname_test : To test class name in snake case + * To test class name in snake case + * + * @param body client model (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java index 27872a7f2d7..186fddfb090 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java @@ -37,6 +37,13 @@ public interface PetApi { return Optional.empty(); } + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) + */ @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"), @@ -55,6 +62,14 @@ public interface PetApi { } + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return successful operation (status code 200) + * or Invalid pet value (status code 400) + */ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @@ -72,6 +87,14 @@ public interface PetApi { } + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 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"), @@ -104,6 +127,15 @@ public interface PetApi { } + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + */ @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"), @@ -136,6 +168,15 @@ public interface PetApi { } + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + */ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }, tags={ "pet", }) @@ -166,6 +207,15 @@ public interface PetApi { } + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + */ @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"), @@ -186,6 +236,14 @@ public interface PetApi { } + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + */ @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"), @@ -203,6 +261,14 @@ public interface PetApi { } + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + */ @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"), @@ -215,7 +281,7 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart("file") MultipartFile file) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java index 1838f04257e..88f857d3eb7 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java @@ -36,6 +36,14 @@ public interface StoreApi { return Optional.empty(); } + /** + * DELETE /store/order/{order_id} : 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 Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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", tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @@ -48,6 +56,12 @@ public interface StoreApi { } + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @Authorization(value = "api_key") }, tags={ "store", }) @@ -62,6 +76,15 @@ public interface StoreApi { } + /** + * GET /store/order/{order_id} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + */ @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, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @@ -90,6 +113,13 @@ public interface StoreApi { } + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + */ @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java index bb6ed796e7b..96b0f11ac16 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java @@ -36,6 +36,13 @@ public interface UserApi { return Optional.empty(); } + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -47,6 +54,12 @@ public interface UserApi { } + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -58,6 +71,12 @@ public interface UserApi { } + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + */ @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -69,6 +88,14 @@ public interface UserApi { } + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @@ -81,6 +108,14 @@ public interface UserApi { } + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @@ -109,6 +144,14 @@ public interface UserApi { } + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + */ @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @@ -122,6 +165,11 @@ public interface UserApi { } + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + */ @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @@ -133,6 +181,15 @@ public interface UserApi { } + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + */ @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), diff --git a/shippable.yml b/shippable.yml index c9ff665bebe..fe67ed0ea62 100644 --- a/shippable.yml +++ b/shippable.yml @@ -10,6 +10,10 @@ build: - $HOME/.stack - $SHIPPABLE_REPO_DIR/samples/client/petstore/elixir/deps ci: + # fix shippable apt-get errors + - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 23E7166788B63E1E 6A030B21BA07F4FB 4B8EC3BAABDC4346 EB3E94ADBE1229CF 960B2B2623A0BD5D 6B05F25D762E3157 + - rm /etc/apt/sources.list.d/jonathonf-ubuntu-backports-xenial.list + # - java -version - mvn --quiet clean install -Dmaven.javadoc.skip=true # ensure all modifications created by 'mature' generators are in the git repo diff --git a/website/dynamic/sponsors.yml b/website/dynamic/sponsors.yml index ab74517f5f9..97559315838 100644 --- a/website/dynamic/sponsors.yml +++ b/website/dynamic/sponsors.yml @@ -8,3 +8,8 @@ image: "img/companies/lightbow.png" infoLink: "https://www.lightbow.net/?utm_source=openapi_generator&utm_medium=official_website&utm_campaign=sponsor" bronze: true +- + caption: "DocSpring" + image: "img/companies/docspring.png" + infoLink: "https://docspring.com/?utm_source=openapi_generator&utm_medium=official_website&utm_campaign=sponsor" + bronze: true diff --git a/website/dynamic/users.yml b/website/dynamic/users.yml index e366ab1d08b..5e55dc0da8c 100644 --- a/website/dynamic/users.yml +++ b/website/dynamic/users.yml @@ -83,6 +83,11 @@ image: "img/companies/commencis.png" infoLink: "https://www.commencis.com/" pinned: false +- + caption: "Crossover Health" + image: "img/companies/crossover_health.png" + infoLink: "https://crossoverhealth.com/" + pinned: false - caption: Cupix image: "img/companies/cupix.png" @@ -93,6 +98,11 @@ image: "img/companies/db-systel.png" infoLink: "https://www.dbsystel.de" pinned: false +- + caption: "DocSpring" + image: "img/companies/docspring.png" + infoLink: "https://docspring.com" + pinned: false - caption: "dwango" image: "img/companies/dwango.png" @@ -113,11 +123,6 @@ image: "img/companies/fenergo.png" infoLink: "https://www.fenergo.com/" pinned: false -- - caption: "FormAPI" - image: "img/companies/formapi.png" - infoLink: "https://formapi.io/" - pinned: false - caption: "FreshCells" image: "img/companies/freshcells.png" @@ -133,6 +138,11 @@ image: "img/companies/gantner.png" infoLink: "https://www.gantner.com/" pinned: false +- + caption: "GetYourGuide" + image: "img/companies/getyourguide.png" + infoLink: "https://www.getyourguide.com/" + pinned: false - caption: "GMO Pepabo" image: "img/companies/pepabo.png" @@ -163,9 +173,14 @@ image: "img/companies/klarna.svg" infoLink: "https://www.klarna.com/us/" pinned: false +- + caption: "Linode" + image: "img/companies/linode.png" + infoLink: "https://www.linode.com/" + pinned: false - caption: "Kronsoft Development" - image: "img/companies/kronsoft.svg" + image: "img/companies/kronsoft.png" infoLink: "https://www.kronsoft.ro/home/" pinned: false - @@ -253,6 +268,11 @@ image: "img/companies/rest-united.png" infoLink: "https://restunited.com/" pinned: false +- + caption: "Sony Interactive Entertainment" + image: "img/companies/sie.jpeg" + infoLink: "https://www.sie.com/en/index.html" + pinned: false - caption: Stingray image: "img/companies/stingray.png" @@ -303,6 +323,11 @@ image: "img/companies/xero.png" infoLink: "https://www.xero.com/" pinned: false +- + caption: Yahoo! Japan + image: "img/companies/yahoo_japan.png" + infoLink: "https://www.yahoo.co.jp" + pinned: false - caption: Yelp image: "img/companies/yelp.png" diff --git a/website/static/img/companies/crossover_health.png b/website/static/img/companies/crossover_health.png new file mode 100644 index 00000000000..c2106c2dee9 Binary files /dev/null and b/website/static/img/companies/crossover_health.png differ diff --git a/website/static/img/companies/docspring.png b/website/static/img/companies/docspring.png new file mode 100644 index 00000000000..edf3b924ec0 Binary files /dev/null and b/website/static/img/companies/docspring.png differ diff --git a/website/static/img/companies/getyourguide.png b/website/static/img/companies/getyourguide.png new file mode 100644 index 00000000000..0239eee16ac Binary files /dev/null and b/website/static/img/companies/getyourguide.png differ diff --git a/website/static/img/companies/linode.png b/website/static/img/companies/linode.png new file mode 100644 index 00000000000..4ab380c7ddb Binary files /dev/null and b/website/static/img/companies/linode.png differ diff --git a/website/static/img/companies/sie.jpeg b/website/static/img/companies/sie.jpeg new file mode 100644 index 00000000000..514601a369e Binary files /dev/null and b/website/static/img/companies/sie.jpeg differ diff --git a/website/static/img/companies/yahoo_japan.png b/website/static/img/companies/yahoo_japan.png new file mode 100644 index 00000000000..7748b162c59 Binary files /dev/null and b/website/static/img/companies/yahoo_japan.png differ